Skip to content

Instantly share code, notes, and snippets.

@mischa
Created December 16, 2008 04:39
Show Gist options
  • Save mischa/36276 to your computer and use it in GitHub Desktop.
Save mischa/36276 to your computer and use it in GitHub Desktop.
module FlashHelper
def flashes
{:partial => '/forms/flashes', :object => flash}
end
def flash_names
[:notice, :error, :message, :success]
end
end
# views/forms/_flashes.html.erb
<% for name in flash_names %>
<% if flash[name] %>
<%= "<div id=\"#{name}\" class=\"flash-#{name}\">#{flash[name]}</div>" %>
<% end %>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment