Guest User

Untitled

a guest
Feb 19th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. @parser.lookup(:location) do |name, operator, value|
  2. location = PreferredLocation.find_by_name(value)
  3. if operator == "name"
  4. tolerance = 1
  5. else
  6. tolerance = 0
  7. end
  8. ["((preferred_locations.lat between ? and ?) AND (preferred_locations.lon between ? and ?))", location.lat - tolerance, location.lat + tolerance, location.lon - tolerance, location.lon + tolerance]
  9. end
  10. end
Add Comment
Please, Sign In to add comment