ruby-on-railsopenshiftgeokit

Geokit undefined method `acts_as_mappable' rails


I used the geokit-rails gem in my web application on my local machine i followed the steps from their github repo and it worked flawlessly on my local machine but once i deployed my app on openshift remote server. it doesn't seem to work. the openshift ruby.log file gives the following error

[ 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 `'

i am sure i added gem 'geocoder' gem 'geokit-rails' gem 'gmaps4rails' to my gemfile but the problem persists. i removed the call to the method all the geokit related code from my app and it worked fine so the problem must be in it. I followed this link Rails 3.1.0, geokit, with error acts_as_mappable and this one Geokit in Ruby on Rails, problem with acts_as_mappable but it didn't solve anything.

I am using Rails 4.2.1

Thanks in advance


Solution

  • You should restart your rails app by ctrl+c, or you should exit the rails console and rails console again.

    for example

    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