Closed micheledisalvatore closed 11 years ago
We removed geo_scope in geokit 2.0.0 as it was going DEEP into the internals of active record/active relation, which made it both really hard to get working with the various rails versions (because it makes us so tied to the internal workings of rails) and we really shouldn't be hacking around in active records classes.
If you look at https://github.com/geokit/geokit-rails/commit/781c4dc62d3b044196efbfad269d4780e6afbe6b there's lots of specs change which show how it now works, but for example:
- locations = Location.geo_scope(:origin => @loc_a).where("distance < 3.97")
+ locations = Location.within(3.9, :origin => @loc_a)
Ok thank you, now it works!
If you removed geo_scope in geokit 2.0.0 it would really be nice to update the README so you aren't still telling users to use geo_scope.
Hi guys, I'm trying to use this gem but I've a big issue.
my gemfile: gem "geokit" gem 'geokit-rails', '~> 2.0.0' # otherwise 1.14 (maybe)
the model: class MyModel < ActiveRecord::Base acts_as_mappable :units => :kms, :distance_field_name => :distance, :lat_column_name => :lat, :lng_column_name => :lng end
in console: MyModel.geo_scope(within: location.range, origin: [location.lat, location.lng])
this is the output: NoMethodError: undefined method
geo_scope' for #<Class:0x007f9eaf632dd8> from .../.rvm/gems/ruby-2.0.0-p0/gems/activerecord-4.0.0/lib/active_record/dynamic_matchers.rb:22:in
method_missing'How can I fix it?
Thank you