how can I get what enviornment is currently running from a controller?.. like development, test, production, etc. thanks..
on 2007-07-15 23:00
on 2007-07-15 23:42
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 Smith <rails-mailing-l...@andreas-s.net>
on 2007-07-15 23:59
Ah, google actually had the answer to my question: rake db:migrate RAILS_ENV=my_production_env
on 2007-07-16 00:03
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?
on 2007-07-16 00:56
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 Smith 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?