Skip to content

Instantly share code, notes, and snippets.

@HamptonMakes
Created August 25, 2008 06:21
Show Gist options
  • Save HamptonMakes/7033 to your computer and use it in GitHub Desktop.
Save HamptonMakes/7033 to your computer and use it in GitHub Desktop.
@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment