Detect Production environment in erb?

Need to conditionally modify a layout based on if the app is running in production mode, any best practice on this?

kevin evans wrote:

Need to conditionally modify a layout based on if the app is running in production mode, any best practice on this?

ENV['RAILS_ENV'] =~ /production/

hth

ilan

In application_helper.rb, add this method :

def production?
@is_production ||=(ENV[‘RAILS_ENV’]==‘production’) end

In your views/layouts, use :

<% if production? %> … <% end %>

Alain Ravet