A2 Hosting Forums

Full Version: RoR - devel vs. prod environments
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a RoR app setup on my account and in the environment.rb file, I've uncommented the line:

ENV['RAILS_ENV'] = 'production'

Also, in the cpanel, the app is switched to "production" mode.

When I view the site in the browser, it is indeed the production version that is being displayed (I know because of the log files and which database is being accessed).

But when I run something like "rake db:migrate" it tries to migrate the development database and when I run "script/console" it loads the development environment.

I know I can "make" it run on either environment, but why would it default to the dev environment?

Greg

GregX999 Wrote:
But when I run something like "rake db:migrate" it tries to migrate the development database and when I run "script/console" it loads the development environment.


Rake (and any other command line tools) uses your current environment, not anything defined in config/environment*. Set RAILS_ENV=production in your .bashrc, .profile or anywhere else where it will be automatically set on login.

Reference URL's