How to determine whether dev,test or prod from the code

When in a controller, how would I determine which
environment I am currently running in? (Development,Test,Production)

Thanks,
Don Mc

On 7/26/06, Don Mc [email protected] wrote:

When in a controller, how would I determine which
environment I am currently running in? (Development,Test,Production)

script/console
Loading development environment.

RAILS_ENV
=> “development”

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’

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs