I am in the process of deploying a Rails application (that works fine in development) to a new production server running Apache and Passenger. When I navigate to the main page, I get the following in my production.log
(along with a 500 Internal Server Error from Apache):
ActionView::TemplateError (uninitialized constant Haml::Filters::Markdown) in app/views/sessions/new.haml
I have the haml and RedCloth gems installed:
*** LOCAL GEMS ***
[...]
haml (3.0.18)
RedCloth (4.2.3)
That constant is defined when I refer to it in a Rails console:
# script/console production
Loading production environment.
>> Haml::Filters::Markdown
=> Haml::Filters::Markdown
The problem doesn't occur in development, and the gems installed and codebase are the same. Any idea what is causing this?
Edit: Just for fun, I tried stopping Apache and Passenger and using script/server production
to test, and it worked perfectly. So whatever the problem is, it has something to do with how Passenger is setting up the environment vs. script/server
, it seems.
Edit 2: And... if I switch the #!/usr/bin/env ruby
line in my script/server
to point to the Ruby Enterprise Edition binary I'm using, it fails with the same error. So something is wrong with that install of ruby...
Edit 3: I discovered the issue was the gems installed under REE vs. standard Ruby. When both RedCloth and BlueCloth are installed, I get this error. When I remove the BlueCloth gem, the error goes away. So that's a temporary solution, but I'm not sure what functionality the BlueCloth gem provides that the RedCloth one doesn't.
Edit 4: I gave up on this issue, and wound up setting up bundler with a version number for rails but none of the other gems. After removing all gems and installing them all with bundle install
, this issue doesn't come up anymore. No idea what the problem was before...