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

Alex Wayne
Wed, 26 Jul 2006 21:24:46 -0000

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/.