【问题标题】:Rails & Geokit - config: Undefined method api_key= for Geokit::Geocoders::GoogleGeocoder:Class (NoMethodError)Rails & Geokit - 配置:Geokit::Geocoders::GoogleGeocoder:Class (NoMethodError) 的未定义方法 api_key=
【发布时间】:2014-06-03 12:45:14
【问题描述】:

我已经设置了 geokit 和 geokit-rails,并且大部分情况下一切正常。我现在在开发过程中遇到了一些“查询太多”的问题,我怀疑罪魁祸首可能没有向 Google Geocoder API 提供 api_key。我按照自述文件中的描述设置了 geokit_config.rb,但在向 Google 提供 api_key 时出错。

....geokit_config.rb:33:in `<top (required)>': undefined method `api_key=' for Geokit::Geocoders::GoogleGeocoder:Class (NoMethodError)

尝试修补一些不同的东西,但没有任何运气。我已经用尽了 Google 和 SO 上的任何相关帖子,但在那里没有找到任何东西。甚至尝试使用 self.api_key 的显式设置器覆盖 google.rb 模块。没运气。有人有什么想法吗?

【问题讨论】:

    标签: ruby-on-rails geokit


    【解决方案1】:

    自述文件适用于 1.8.5,其中包括对 Google 的公共 API (https://github.com/geokit/geokit/commit/2bc71d541b0983372e34fdf1fedb0b2bea2fb76b) 的支持

    但发布的版本是 1.8.4,不支持公共 API

    在 1.8.5 发布之前,您可以通过直接从 github 拉取 master 来解决此问题。

    gem 'geokit', branch: 'master', git: 'https://github.com/geokit/geokit.git'
    

    【讨论】:

    • 这就像一个魅力。错误已解决,我现在在 API 控制台中看到我的调用报告。非常感谢您的回复!
    • 不用担心。查看提交日志,我看到 1.8.5 已经发布 - github.com/geokit/geokit/commit/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多