Note that when setting the Rails environment you have to pass it differently in different cases. For rake, set RAILS_ENV= as part of the command line options.

rake db:migrate RAILS_ENV=test

But when running script/console, you just put the environment name after the “script/console”:

script/console test

By Jason

4 thoughts on “How do I set the rails environment (RAILS_ENV)?”
  1. Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?

Leave a Reply

Your email address will not be published. Required fields are marked *