Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @parser.lookup(:location) do |name, operator, value|
- location = PreferredLocation.find_by_name(value)
- if operator == "name"
- tolerance = 1
- else
- tolerance = 0
- end
- ["((preferred_locations.lat between ? and ?) AND (preferred_locations.lon between ? and ?))", location.lat - tolerance, location.lat + tolerance, location.lon - tolerance, location.lon + tolerance]
- end
- end
Add Comment
Please, Sign In to add comment