I recently switched to DreamHost and have installed my first Rails app on my account, Typo. I noticed that FastCGI isn’t passing the RAILS_ENV environment variable to the application because when the application is loaded, it tries pulling the development database connection. When I uncomment the production line in environment.rb file it works properly.

Does anyone else have this issue?

Yeah, I see this too. I think that is how you have to do it.

I am confused about one thing though. As I understand it, FastCGI loads a ruby instance up once so that it doesn’t have to reload ruby for every request. How then do you get it to re-load ruby in the case you make a configuration change?

I’m trying to deploy a rails app and I’m having to tweak the settings, but I’m never sure if and when they are taking place on the server.

More information on this:

From the dreamhost Ruby on Rails wiki (http://wiki.dreamhost.com/Ruby_on_Rails#Switching_to_FCGI_with_Dreamhost), Fast CGI should set RAILS_ENV to production. You should only have to overwrite RAILS_ENV if you want to set development. HOWEVER, this is not currently happening, so you need to put the following in config/environment.rb:
ENV[‘RAILS_ENV’] ||= ‘production’

Hopefully, dreamhost will correct this issue. Running in development by default is not what anyone wants for a live system.

And to answer my own question about not knowing when fast cgi reloads: simply touch public/dispatch.fcgi and the next time your rails app is accessed your app will be reloaded. In my rails log directory, fastcgi.crash.log keeps track of when fast cgi is started and stopped.