Reputation:
I added this to my application.html.erb file:
<%= render :partial => 'layouts/ga' if RAILS_ENV == 'production' %>
And I get the error uninitialized constant ActionView::CompiledTemplates::RAILS_ENV
on this exact line.
When I take the if RAILS_ENV == 'production'
off, the error goes away but isn't this suppose to work fine? What does the error tries to tell me?
Upvotes: 0
Views: 1805
Reputation: 38645
RAILS_ENV
should be a key in environment variable array ENV
. Try:
<%= render :partial => 'layouts/ga' if ENV["RAILS_ENV"] == 'production' %>
or,
<%= render :partial => 'layouts/ga' if Rails.env.production? %>
Upvotes: 2