[Rails] Re: How to determine whether dev, test or prod from the code

Alex Wayne rubyonrails at beautifulpixel.com
Wed Jul 26 21:14:49 GMT 2006


Don Mc wrote:
> When in a controller, how would I determine which
> environment I am currently running in? (Development,Test,Production)
> 
> Thanks,
> Don Mc

I use the Rails Environments plugin.  Makes it super easy:

  Rails.production?
  Rails.development?
  Rails.test?

http://plugins.radrails.org/directory/show/24

Or do it by hand without this dinky plugin:

  ENV['RAILS_ENV'] == 'production'

-- 
Posted via http://www.ruby-forum.com/.


More information about the Rails mailing list