geokit / geokit-rails

Official Geokit plugin for Rails/ActiveRecord. Provides location-based goodness for your Rails app. Requires the Geokit gem.
MIT License
1.57k stars 245 forks source link

Rails 4.2.5 Geokit in_bounds method error #94

Closed jpletner closed 8 years ago

jpletner commented 8 years ago

I'm upgrading our platform from 4.0 to 4.2.5, using mySQL db. I’m using the in_bounds method. This expression: Location.in_bounds([south_west_point, north_east_point]) was working just great in Rails 4.0, returning 3 locations but since upgrading to rails 4.2.5 it returns an empty array.

When converting the expression to sql, I get the following: Location.in_bounds([south_west_point, north_east_point]).to_sql =

SELECT locations.* FROM locations WHERE ('(locations.latitude>31.0 AND locations.latitude<33.0 AND locations.longitude>-120.0 AND locations.longitude<-116.0)')

The quotes inside the WHERE seem to be the issue. When I remove the quotes and run the query, I get 3 locations which is what I expected and what I got previously.

This was the sql in 4.0: SELECT locations.* FROM locations WHERE ((locations.latitude>31.0 AND locations.latitude<33.0 AND locations.longitude>-120.0 AND locations.longitude<-116.0)). NO QUOTES!

How do I get rid of those dang quotes and why are they there?

I'm running Geokit-rails was version 2.1.0 in both our rails versions 4.0 and 4.2.5. I upgraded Geokit to version 1.10 in version 4.2.5 hoping it would help but no luck. Any advice will be greatly appreciated!