Switching Rails from development to production?


#1

I’ve been developing & testing a Rails application on my home machine, and occasionally checking it out of subversion into my Dreamhost account. Up until now, development mode has worked fine on Dreamhost. I decided to switch over to production mode. I followed all the instructions in the wiki (changing environment.rb, etc. - I also tried some troubleshooting tips, like ‘rake rails:update:configs’), I created a new database (different DB name but on the same host as the development DB), and I tried to do ‘rake migrate’ so that the DB tables would be created in the production database, but it didn’t work. And now the application is ‘broken.’

As far as I can tell, the Rails application is trying to check the production database and is failing because the database is empty (because rake migrate didn’t work). No matter what I do, I can’t get ‘rake migrate’ to work on the new, production database - it seems to be doing its thing on the old, development one.

Any suggestions on how to get ‘rake migrate’ to work on the production database??!? Or are there general suggestions for switching from the development mode to production mode?


#2

A friend helped me figure out the solution. rake was, as I suspected, hitting the development database instead of the production one. The way to get it to work was to issue this variation from the command line:
RAILS_ENV=production rake db:migrate
That forced rake to hit the production database, then everything went fine.