简体   繁体   English

ArgumentError: Unknown key: origin using geokit-rails

[英]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.我有一个 rails 4 应用程序,我试图在其中查找 N 英里内的所有应用程序。 Based on geokit-rails documention HERE I should be able to do:基于 geokit-rails 文档这里我应该能够做到:

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. SapApplication 模型具有acts_as_mappable和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.就像旁白SapApplication.by_distance(:origin => [37.792,-122.393])确实有效,所以我至少知道 geokit 安装正确。

他们有一些新的范围,所以你可以这样做:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM