Created
June 20, 2010 19:38
-
-
Save gr4y/446040 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
<%= flash_messages %> |
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
FLASH_KEYS = [:error,:notice] | |
def flash_messages | |
return unless messages = flash.keys.select{|k| FLASH_KEYS.include?(k)} | |
formatted_messages = messages.map do |type| | |
content_tag :div, :class => type.to_s, :id => 'flash' do | |
flash[type] | |
end | |
end | |
formatted_messages.join | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment