Rails 3 and Passenger

Published on and tagged with configuration  ruby on rails

This weekend the RailsBridge people have organized a bugmash with the motto “Do One Thing for Rails 3”, and so I took the opportunity to experiment a bit with the coming Rails 3.

After following the instructions for creating a new Rails 3 app (using the –database=mysql parameter for the “rails” command) I noticed that the application tried to access the (not existing) production database. That was a bit strange, because I expected it to access the development database as I set the RailsEnv option of Passenger accordingly:

# for example in /etc/httpd/conf/httpd.conf
RailsEnv development

The reason this doesn’t work is because the generated application contains a “config.ru” file. In this case, Passenger treats the application as a Rack application and not as a Rails application. And so the RailsEnv setting is ignored as it is Rails-specific…

There are two ways to run the application in development mode: you can either remove the “config.ru” file (and keep the RailsEnv setting) or you can set the RackEnv option:

# for example in /etc/httpd/conf/httpd.conf
RackEnv development

Have fun with Rails 3 :)

29 comments baked

© daniel hofstetter. Licensed under a Creative Commons License