Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on Rails, rake db:seed or db:reset - how do you dictate which mode (development/test/production)?

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.

like image 527
JamesWHurst Avatar asked Nov 28 '25 16:11

JamesWHurst


1 Answers

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

RAILS_ENV=production bundle exec rake db:seed
like image 168
Marek Lipka Avatar answered Dec 01 '25 05:12

Marek Lipka