Changing .htacces / database.yml in Rails apps


Hi! I’m kinda new to Rails and not very experienced with Unix, so I need some pointers.

I changed my .htaccess to use the dispatch.fcgi, which results in an error at dreamhost. I have no clue why, but it seems to be database releated.

The error i get is; Application error (Rails) … and the log talks about mysql socks, which doesn’t really reflect my database.yml (I think). But my app works in normal cgi mode.

Do I need to restart the web server so the changes get applied? Or does it all happen automatically when my Rails app fails? also, can anyone point to some Rails documentation for things like this, preferably Dreamhost specific? (the wiki entry doesn’t mention anything about this).

Thank you.


cgi will run in development mode by default, fastcgi in production mode. That may be why one runs and the other doesn’t.

database.yml has two sections. Maybe the production setting is wrong - typo, missing space, etc.

To debug:
Try “ruby script/console” to run rails console in development mode. Exit, then run “ruby script/console production” to run it in production mode. It a database error due to database.yml, you’ll likely see something here. I always try something like “Article.find :first” to test access to database, where Article is one of your business objects.

If you want to run fastcgi in development mode to compare, edit environment.rb in config directory.

RAILS_ENV = ENV[‘RAILS_ENV’] || 'development’
RAILS_ENV = ‘development’

I believe that the dreamhost fastcgi spawner sets RAILS_ENV, so you have to do it this way.