Get which enviornment is running from controller

how can I get what enviornment is currently running from a controller?..
like development, test, production, etc.

thanks…

I’d like to know this also. I need to know how force a rake task to
pick up an environment other than ‘production’ on my production host.
I renamed my environment to something more specific, but “rake
db:migrate” always uses the configuration under the “production”
environment…

On Jul 15, 2:00 pm, Aaron S. [email protected]

Ah, google actually had the answer to my question:
rake db:migrate RAILS_ENV=my_production_env

zaven wrote:

Ah, google actually had the answer to my question:
rake db:migrate RAILS_ENV=my_production_env

I’m looking to find out how you access this in a controller. is it still
RAILS_ENV?

if you take a look at your rails gem.
in rails/lib/initializer.rb, line 12-ish,
there’s the following;

RAILS_ENV = (ENV[‘RAILS_ENV’] || ‘development’).dup unless
defined?(RAILS_ENV)

So,
indeed,
calling RAILS_ENV from anywhere inside you app will return the
environment.

Aaron S. wrote:

zaven wrote:

Ah, google actually had the answer to my question:
rake db:migrate RAILS_ENV=my_production_env

I’m looking to find out how you access this in a controller. is it still
RAILS_ENV?