在我的 rails 4 项目中使用 Yahoo BOSS 作为地理编码服务和地理编码器 gem。得到错误..
undefined method `[]' for nil:NilClass /Users/local/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/geocoder-1.2.8/lib/geocoder/lookups/yahoo.rb:33:in `results'
/Users/local/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/geocoder-1.2.8/lib/geocoder/lookups/base.rb:47:in `search'
/Users/local/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/geocoder-1.2.8/lib/geocoder/query.rb:11:in `execute'
/Users/local/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/geocoder-1.2.8/lib/geocoder.rb:21:in `search'
/Users/local/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/geocoder-1.2.8/lib/geocoder/stores/base.rb:111:in `do_lookup'
/Users/local/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/geocoder-1.2.8/lib/geocoder/stores/active_record.rb:259:in `geocode'
配置.yml
Geocoder.configure({
lookup: :yahoo,
api_key: [APP_CONFIG["yahoo"]["consumer_key"], APP_CONFIG["yahoo"]["consumer_secret"]],
use_https: true,
always_raise: :all,
cache: Rails.cache
})
从 rails 控制台手动运行导入脚本时出现此错误,试图将地理编码抓取的事件地址反转为 lat long。
如果需要更多信息,请告诉我。非常难过这个问题,任何建议将不胜感激!谢谢!