![](/img/trans.png)
[英]TypeError: no implicit conversion of Symbol into Integer for search with geokit-rails
[英]Geokit Rails: no implicit conversion of Symbol into Integer
我收到了一個模型而不是另一個模型發生的錯誤。 我可以運行Job.all.within(5, :origin => [0, 0])
,但不能運行User.all.within(5, :origin => [0, 0])
,即使它們具有相同的信息在他們的模型中: acts_as_mappable lng_column_name: :longitude, lat_column_name: :latitude
對於損壞的情況,它似乎在這里損壞(這是來自 Geokit gem 的代碼):
def within(distance, options = {})
options[:within] = distance
#geo_scope(options)
where(distance_conditions(options)) # HERE
end
如果我中斷,我可以輸出:
>> options
=> {:within=>5}
>> distance_conditions(options)
!! #<TypeError: no implicit conversion of Symbol into Integer>
這是怎么回事?
geocoder
gem 似乎存在依賴性問題。 刪除geocoder
gem 應該可以工作
Location.within(5, :origin => [37.792,-122.393])
我的解決方法是:您需要在模型中的“geocoded_by”之后使用“acts_as_mappable”。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.