3
votes

With Ruby on Rails, when you reset or re-seed the database using rake db:seed or db:reset - how do you dictate which mode (development/test/production) the operation is to be in?

I'm using Sqlite for development, and postgresql for both test and production - but with different connection arguments. I do not seem to be able to control which mode Rails runs on on my development box (I'm running in a virtual machine, Ubuntu 13.l0) nor when on Heroku.

Also, how do you dictate which mode (development/test/production) to run your app in, when running it on Heroku? The way that Heroku's document suggests, does not work (that is, putting into the Procfile a single line with web: bundle exec unicorn -p $PORT -E $RACK_ENV and including a .env file that has RACK_ENV=test (for example). ? Thank you for any help. I am really hating Ruby-on-Rails.

1

1 Answers

12
votes

You can set environment with RAILS_ENV env variable, for example:

RAILS_ENV=production bundle exec rake db:seed