Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am deploying my app with capistrano/passenger/nginx. The deployment goes well. However, the app dies when I try to load it:

Error message: uninitialized constant Object::Rails

The last line of the backtrace is:

/opt/app/releases/20101208120133/system/config/environment.rb   1   in `'

This corresponds to the following:

require "#{Rails.root}/lib/formats.rb"

However, if I enter rails console on the server, it detects Rails.root just fine. I am running rails 3.0.3 (although it doesnt work for 3.0.0 either).

share|improve this question

2 Answers 2

I'm surprised to see that the stacktrace indicates that environment.rb is located in system/config/. Do you have it symlinked to current/config/environment.rb?

share|improve this answer

I had the same problem, and I had to use File.expand_path instead.

File.expand_path('/lib/formats.rb')

My best guess at the reason for this is that because environment.rb is one of the first things that gets loaded, maybe passenger is looking at it before it knows about the Rails object or something. It doesn't make a lot of sense... maybe I'm way off :) But this workaround seems to work.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.