Geocoder SQLite3 :: SQLException:没有这样的列:lon:

时间:2012-02-03 00:19:03

标签: ruby-on-rails-3 rails-geocoder

我正在尝试使用Geocoder

我正在尝试获取以下查询的结果(我在控制器中有这个):

Event.near([params[:lat].to_f, params[:lng].to_f], params[:radius].to_f, unit: :km)

在我的模特中,我有:

geocoded_by :address, :latitude  => :lat, :longitude => :lng 
after_validation :geocode

但我得到以下内容:

ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: lon: SELECT events.*, (69.09332411348201 * ABS(lat - -33.425329) * 0.7071067811865475) + (59.836573914187355 * ABS(lon - -70.604895) * 0.7071067811865475) AS distance, CASE WHEN (lat >= -33.425329 AND lon >= -70.604895) THEN  45.0 WHEN (lat <  -33.425329 AND lon >= -70.604895) THEN 135.0 WHEN (lat <  -33.425329 AND lon <  -70.604895) THEN 225.0 WHEN (lat >= -33.425329 AND lon <  -70.604895) THEN 315.0 END AS bearing FROM "events" WHERE (lat BETWEEN -33.714792566221696 AND -33.1358654337783 AND lon BETWEEN -70.95172225903696 AND -70.25806774096304) ORDER BY distance

感谢任何帮助

1 个答案:

答案 0 :(得分:0)

总会发生这种情况......我们应该先问这里:重启电脑。

重新启动计算机后问题得到解决...不知道为什么有必要这样做。也许有些东西卡在内存中,需要一些硬重置......