Closed jan closed 3 years ago
This worked for me, too. Very clunky. I thought ensuring I was on 3.0.7 rails/activerecord might help; it does not. For now I have this kludge in my application.rb
Have the same problem and I have no idea how to fix it. The suggested monkey patch doesn't work for me and I have no idea where to start looking. Any time I try a count + group by I get unkown key(s)
I had a similar problem using the acts_as_geocodable plugin.
You can avoid duplicating the existing find options with this fix:
# Put in config/initializers/geo_find_options.rb
ActiveRecord::SpawnMethods::VALID_FIND_OPTIONS.push(:within, :origin, :beyond, :units)
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.
I just started migrating my app to Rails 3 and for my old find syntax, Court.all(:conditions => ["auctions_count > 0 AND id <> ?", @court.id], :origin => [@court.lat, @court.lng], :within => 150.0, :order => "auctions_count DESC", :limit => 5) I get the following error, and provide an easy (and nasty) fix for it below.
It works when I monkey patch the following with an initializer. module ActiveRecord module SpawnMethods VALID_FIND_OPTIONS = [ :conditions, :include, :joins, :limit, :offset, :extend, :order, :select, :readonly, :group, :having, :from, :lock, :origin, :within ] end end
This works for me with
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9]
rails 3.0.1
geokit gem 1.5.0
geokit_rails plugin 1.?.? (says 1.1.4 in about.yml and 1.2.0 in CHANGELOG.rdoc, checked out November 21, 2010)