Ruby on rails 3 地理编码API';的响应无效
我用的是gem,它工作很好。现在,我试图升级,但google_premier出现以下错误Ruby on rails 3 地理编码API';的响应无效,ruby-on-rails-3,google-geocoder,Ruby On Rails 3,Google Geocoder,我用的是gem,它工作很好。现在,我试图升级,但google_premier出现以下错误 1.9.2p320 :001 > Geocoder.search("Hyderabad") Geocoding API's response was not valid JSON. => [] 我在config/initializers/geocoder.rb中添加了新文件,这是我的配置设置 Geocoder::Configuration.lookup = :google_premier
1.9.2p320 :001 > Geocoder.search("Hyderabad")
Geocoding API's response was not valid JSON.
=> []
我在config/initializers/geocoder.rb中添加了新文件,这是我的配置设置
Geocoder::Configuration.lookup = :google_premier
Geocoder::Configuration.api_key = "xxx-key"
您只需要在Geocoder配置上注释api_键行,以避免Geocoder发送它。Google geocoder DOS不需要API密钥 Geocoder.rb示例:
# -*- encoding : utf-8 -*-
Geocoder.configure(
:timeout => 5,
:lookup => :google,
#:ip_lookup => :google,
#:api_key => "xxxx-xxx",
:units => :km
)
我也面临同样的问题。我的解决方案可能很愚蠢,但它对我有效。我的解决方案是重新安装gem。希望这能对你有所帮助