Skip to content

Instantly share code, notes, and snippets.

@adrianpacala
adrianpacala / _flash.html.erb
Last active August 12, 2017 06:27
Enumerable flash messages in Rails
<% flash.now[:alert] = 'This an example alert message.' %>
<% flash.now[:error] = 'This an example error message.' %>
<% flash.now[:notice] = 'This an example notice message.' %>
<% flash.now[:success] = 'This an example success message.' %>
<% flash.now[:secret] = 'This will not be shown.' %>
<% flash.now[:cool] = true %>
<% flash_messages.each do |type, message| %>
<div class="flash-<%= type %>"><%= message %></div>