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 :)

[...] This post was mentioned on Twitter by Daniel Hofstetter, Leonhard Melzer. Leonhard Melzer said: RT @dhofstet: my small contribution to "Do One Thing for Rails 3": http://cakebaker.42dh.com/2010/01/17/rails-3-and-passenger/ [...]
In fact, you’ll find that removing config.ru will not be a help.
Thus you should always use
RackEnvand this should be no problem as rails is now a friendly rack citizen rather than one that polluted namespaces (before you could never run two different rails endpoints, now i believe you can)[...] Rails 3 and Passenger January 17th 2010 5:05am This weekend the RailsBridge people have organized a bugmash with the motto 8220Do One Thing for Rails 38243 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 8211databasemysql parameter for the 8220rails8221 command I noticed that the From: cakebaker.42dh.com [...]
[...] Rails 3 and Passenger – cakebaker Tags: daniel, daniel-hofstetter, leonhard, leonhard-melzer, melzer, mentioned-on-twitter, rails, [...]
@Lenary: Thanks for your comment.
At least in my tests it worked fine when I removed config.ru, and the guys from Phusion suggest you remove it if you want to make use of smart spawning as it is not supported for Rack apps (http://blog.phusion.nl/2010/01/08/phusion-passenger-2-2-9-released/. However, on a dev machine it probably doesn’t matter which approach you use.
[...] Rails 3 and Passenger (01/17/10) — A few tips on how to run Rails 3 on passenger. [...]
[...] Rails 3 and Passenger [...]
Social comments and analytics for this post…
This post was mentioned on Twitter by dhofstet: my small contribution to “Do One Thing for Rails 3″: http://cakebaker.42dh.com/2010/01/17/rails-3-and-passenger/...