DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Standardizing Rails Flash Messages
a proposal from Luke Randall on the rails mailing list
:notice for positive feedback (action successful, etc) :message for neutral feedback (reminders, etc) :warning for negative feedback (action unsuccessful, error encountered, etc)
Then, in your controller or view you could place code such as the following:
FLASH_NAMES = [:notice, :warning, :message]
<% for name in FLASH_NAMES %>
<% if flash[name] %>
<%= "<div id=\"#{name}\">#{flash[name]}</div>" %>
<% end %>
<% end %>





