4

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

Community
  • 1
  • 1
  • What does geokit-rails do? I'm using maps in my app, and I only have gem 'geocoder' and gem 'gmaps4rails'. – fatfrog May 16 '15 at 01:35
  • This is the demo I used - I remember doing tutorials that where using acts_as_mappable, and later discovered that has been depreciated. https://www.youtube.com/watch?v=R0l-7en3dUw&spfreload=10 – fatfrog May 16 '15 at 01:38
  • I don't think that OpenShift Online currently supports rails 4.2 (what version of ruby are you using?) Could have something to do with your error. Do you get any other errors when you git push to deploy your application? –  May 17 '15 at 21:34
  • no it pushes successfully – user3538203 May 19 '15 at 17:27
  • I got this error when trying to upgrade an old site from [`geokit-rails3`](https://github.com/geokit/geokit-rails3). I'd carelessly replaced it with just `geokit` in the Gemfile, when I needed `geokit-rails`. – mwfearnley Mar 03 '20 at 11:49

2 Answers2

1

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
kittykittybangbang
  • 2,380
  • 4
  • 16
  • 27
Lin
  • 26
  • 2
0

When using Spring, you should stop that before trying again:

$ spring stop
Spring stopped.
Koen.
  • 25,449
  • 7
  • 83
  • 78