Created
December 16, 2008 04:39
-
-
Save mischa/36276 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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