Skip to content

Instantly share code, notes, and snippets.

@gr4y
Created June 20, 2010 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gr4y/446040 to your computer and use it in GitHub Desktop.
Save gr4y/446040 to your computer and use it in GitHub Desktop.
<%= flash_messages %>
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