我得到了一个错误,发生在一个模型,而不是另一个模型。我可以运行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>到底怎么回事?
发布于 2018-01-01 02:49:54
geocoder gem似乎存在依赖问题。删除geocoder gem应该可以
Location.within(5, :origin => [37.792,-122.393])发布于 2020-02-06 00:20:51
我的解决方法是:在你的模型中,你需要在"geocoded_by“之后加上"acts_as_mappable”。
https://stackoverflow.com/questions/28420552
复制相似问题