我正在开发一个ruby应用程序,该应用程序会根据您的ip地址确定您的位置。尽管我遇到了路障。我已经在这个网站上搜索过,但我已经找到的解决方案太笼统了。未初始化的常量Ruby
这里的错误:
uninitialized constant Place::IpGeocoder (NameError)
而且我开发的代码:
require 'socket'
require 'geocoder'
require 'geokit'
class Place
def get_location
ip = UDPSocket.open {|s| s.connect("64.233.187.99", 1); s.addr.last}
location = IpGeocoder.geocode(ip.to_s())
end
end
me=Place.new
me.get_location
我已经安装了宝石。我是否需要在java中创建它的一个实例或类似的东西?
哦好吧,我现在看到的,所以如果我是做类似的soltion到http://stackoverflow.com/questions/4889599/rails-how-to-get-latitude-and-longitude-from-string-address把它放在谷歌它会是正确的相同的事情。随着包括和MultiGeocoder –
@CalvinJones尝试通过你的自我.. :)尝试和学习.. –
我没有和得到了同样的错误,但由于 –