Geokit 未定义方法`acts_as_mappable'rails

Geokit undefined method `acts_as_mappable' rails

我在本地机器上的 Web 应用程序中使用了 geokit-rails gem 我按照他们 github 存储库中的步骤进行操作,它在我的本地机器上运行完美,但有一次我在 openshift 远程服务器上部署了我的应用程序。它似乎不起作用。 openshift ruby.log 文件给出以下错误

[ 2015-05-15 21:10:52.1608 54455/7fec5b5fe700 agents/HelperAgent/RequestHandler.h:1971 ]: [Client 20] Cannot checkout session. An error occured while starting the web application. Error page: undefined method acts_as_mappable' for Group (call 'Group.connection' to establish a connection):Class (NoMethodError) /var/lib/openshift/555682cde0b8cd2874000091/app-root/runtime/repo/vendor/bundle/ruby/gems/activerecord-4.2.1/lib/active_record/dynamic_matchers.rb:26:inmethod_missing' /var/lib/openshift/555682cde0b8cd2874000091/app-root/runtime/repo/app/models/group.rb:2:in `'

我确定我添加了 gem 'geocoder' gem 'geokit-rails' gem 'gmaps4rails' 到我的 gem 文件,但问题仍然存在。我从我的应用程序中删除了对所有与 geokit 相关的代码的方法的调用,它工作正常,所以问题一定出在其中。我按照这个 link Rails 3.1.0, geokit, with error acts_as_mappable and this one Geokit in Ruby on Rails, problem with acts_as_mappable 但是它没有解决任何问题。

我正在使用 Rails 4.2.1

提前致谢

您应该通过 ctrl+c 重新启动您的 rails 应用程序,或者您应该退出 rails 控制台并再次 rails 控制台。

例如

Location.class
NameError: undefined local variable or method `acts_as_mappable' for Location (call 'Location.connection' to establish a connection):Class
    from /Users/caiqinghua/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.1/lib/active_record/dynamic_matchers.rb:26:in `method_missing'
    from /Users/caiqinghua/weishop/app/models/location.rb:11:in `<class:Location>'
    from /Users/caiqinghua/weishop/app/models/location.rb:10:in `<top (required)>'

2.2.1 :018 >   exit
caiqinghua@qinghuadeMacBook-Pro:~/location(set-shop-location|✚1…) % rails c                                                                              (set-shop-location00)
Loading development environment (Rails 4.2.1)
2.2.1 :001 > Location.class
 => Class

使用 Spring 时,您应该在再次尝试之前停止它:

$ spring stop
Spring stopped.