Using Rails 3 with Geokit-rails3 location gem

徘徊边缘 提交于 2019-12-05 22:56:55

I just had this issue and resolved it by entering the full

Geokit::Geocoders::IpGeocoder.geocode(request.remote_ip)

and that seemed to solve it for me.

Had the same issue and couldn't get IpGeocoder to work in Rails3 with above suggestions. Dug into the Rails3 source code for the gem. Looks like an easy way to work around this is use the Geokit MultiGeocoder method for Rails 3.

Example: loc = Geokit::Geocoders::MultiGeocoder.geocode(remote.request_ip)

Don't forget to set up MultiGeocoder correctly in your initializer - geokit_config.rb Geokit::Geocoders::provider_order = [:google,:us]

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!