Skip to content

Instantly share code, notes, and snippets.

@coop
Created February 23, 2012 04: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 coop/1890261 to your computer and use it in GitHub Desktop.
Save coop/1890261 to your computer and use it in GitHub Desktop.
module ApplicationHelper
def flash_messages
flash.inject([]) do |array, (level, message)|
array << content_tag(:div, flash_content(message), class: "alert-message #{level} fade in", data: {alert: 'alert'})
end.join.html_safe
end
private
def flash_content message
link_to('&times;'.html_safe, '#', class: 'close') + content_tag(:p, message)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment