Dynamically determine environment?

Does anyone know what the syntax is to determine the current environment (prod, dev, etc.) in code?

if RAILS_ENV == 'production'

I really love Coda Hale's plugin:
http://blog.codahale.com/2006/04/09/rails-environments-a-plugin-for-well-rails/

It lets you do Rails.production? and Rails.development? etc. Reads so nicely.

Thanks Chris, hadn’t heard of that one. I actually decided to just use PJ’s Cappin That Stat tip to only include the analytics code when deploying to the production server.

  • Nathan