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

NoMethodError: undefined method merge_conditions #15

Closed aja closed 3 years ago

aja commented 14 years ago

Ruby -> ruby 1.9.2dev (2010-04-04 trunk 27215) [i686-linux] Rails -> Rails 3.0.0.beta2

Statement producing the error: Location.find(:all, :origin =>[37.792,-122.393], :within=>10)

Stack trace: NoMethodError: undefined method merge_conditions' for #<Class:0x9692d24> from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.beta2/lib/active_record/base.rb:1154:inmethod_missing' from /home/ahmad/geok/vendor/plugins/geokit-rails/lib/geokit-rails/acts_as_mappable.rb:349:in apply_bounds_conditions' from /home/ahmad/geok/vendor/plugins/geokit-rails/lib/geokit-rails/acts_as_mappable.rb:260:inprepare_for_find_or_count' from /home/ahmad/geok/vendor/plugins/geokit-rails/lib/geokit-rails/acts_as_mappable.rb:152:in find' from (irb):1 from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta2/lib/rails/commands/console.rb:47:instart' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta2/lib/rails/commands/console.rb:8:in start' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta2/lib/rails/commands.rb:34:in<top (required)>' from ./script/rails:9:in require' from ./script/rails:9:in

'

andre commented 14 years ago

A lot of the internals of the plugin will have to be revamped for Rails3. Ideally using ARel instead of the SQL string munging we do now.

tute commented 14 years ago

For a quick-and-dirty fix, paste the following in 'geokit-rails/lib/geokit-rails/acts_as_mappable.rb': http://gist.github.com/394328

brianlong commented 14 years ago

gist code should go into ActsAsMappable::ClassMethods section of acts_as_mappable.rb

sscirrus commented 13 years ago

I wish I knew how to revamp this gem for Rails 3 myself, but does anyone know if significant progress has been made on this issue?

nclsjstnn commented 13 years ago

Another workaround it's adding ActiveRecord's old merge_conditions method to your initializers. First create the file: config/initializers/active_record_base.rb and put the following code in it (as a gist: http://gist.github.com/561092):

It works for me in Rails 3.1

ryankopf commented 3 years ago

I am closing all issues that are more than 6 years old now, as the gem has had significant updates and is likely people with these old issues are no longer having the issues. If you are currently still experiencing this issue or need help feel free to submit a new issue, thank you.