Mark Locklear
Mark Locklear

Reputation: 5325

ArgumentError: Unknown key: origin using geokit-rails

I have a rails 4 app where I am trying to find all applications within N number of miles. Based on geokit-rails documention HERE I should be able to do:

SapApplication.find(:all, :origin=>'100 Spear st, San Francisco, CA', :within=>10)

When I try and execute the command above in the console I get the error:

ArgumentError: Unknown key: origin

The SapApplication model has acts_as_mappable and attributes for lat/lng.

Just as an aside SapApplication.by_distance(:origin => [37.792,-122.393]) does work, so I at least know geokit is installed correctly.

Upvotes: 1

Views: 49

Answers (1)

smathy
smathy

Reputation: 27961

They have some new scopes so you could do:

SapApplication.within 10, origin: '100 Spear st, San Francisco, CA'

Upvotes: 1

Related Questions