Im curious how you guys visual make distinction between the different Rails modes development/test and production?
Im afraid that since visually the apps look the same in each mode, my customer can use the wrong environment and enter production data in a test environment.
Now i change the background in my application CSS, to make sure there is a difference. BUt i rather would have something smart that automatically works based on the environment thats running. Maybe a BIG watermark?
Any best practices here?
Based on Artimuz answer i did the following:
Add this to the application_helper.rb
def development?
@is_development ||= (ENV['RAILS_ENV'] != 'production')
end
then in application.html.erb i added:
<head>
<% if development? %>
<style type="text/css">
html {
background-image: url(/assets/test.png);
background-color: silver;
}
</style>>
<% end %>
</head>
The test.png is just a transparent png with the word ‘test’ inside and a diagonal line. Works like a charm (its tiled), for sure you you can’t miss your inside the development/test environment.
From here: http://markmail.org/message/grmor6rppm5jwgnh
You can test RAILS_ENV environment variable.
In application_helper.rb, add this method :
An d in your views/layouts: