amunds
amunds

Reputation: 702

Production not finding certain gem methods

I've added added the gem simple-navigation 3.9.0 to my gemfile in rails 3.2.11 and it runs fine in development. However, when I deploy to my production server and try to open a page with the method I get the following error:

undefined method `render_navigation'

I don't believe it's specific to that one gem though, as I had the same problem earlier when I used the uuid gem.

Using $LOADED_FEATURES I find "simple_navigation", so it seems to be loaded.

Info about the production server

nginx 1.2.6
Unicorn 4.5.0
Rubygems 1.8.23
Ubuntu 12.04 LTS
rbenv 0.4.0-9-g045f6c1

EDIT

Other gems work, the server runs fine, except for the above problem.

Upvotes: 1

Views: 284

Answers (4)

amunds
amunds

Reputation: 702

While technically not an answer, I decided to switch over to Linode as my host. This involved a complete re-install of my server setup and it's working now. I did the exact same steps installing the server this time as last, so I'm still not sure what was wrong, or if it would have been easily fixable. Since I no longer have the old server available it would be impossible to confirm any solutions proposed from now on.

I'm going to mark this answer as the solution unless there are any objections within the next 48 hours.

Upvotes: 0

Sakares
Sakares

Reputation: 606

Have you try RAILS_ENV=production bundle install ?

Upvotes: 0

Harish Shetty
Harish Shetty

Reputation: 64363

Make sure your gem is not declared inside the development group in the Gemfile

The gems in the development group are not be loaded in production.

group :development do
  gem "simple-navigation"
end

Also, if you have a <APP_HOME>/.bundle/config file, ensure that it doesn't have the BUNDLE_WITHOUT option.

Gemfile

group :ui do
  gem "simple-navigation"
end

.bundle/config

---
BUNDLE_WITHOUT: ui

In the above example, the gem group ui will not be loaded.

Upvotes: 1

Victor Ronin
Victor Ronin

Reputation: 23268

Having said that I had very-very limited exposure to Rails, I saw similar behavior when Gemfile.lock wasn't committed into repository. As result when project was pushed to production envinronment there was some screw ups with dependency resolution.

Upvotes: 0

Related Questions