Skip to content

Instantly share code, notes, and snippets.

@mdepolli
Last active October 10, 2015 08:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mdepolli/3662482 to your computer and use it in GitHub Desktop.
Save mdepolli/3662482 to your computer and use it in GitHub Desktop.
Bootstrap 2.1-compatible flash messages helper
def flash_message
types = { :notice => 'info', :success => 'success', :error => 'error', :alert => 'error' }
flash.inject("") do |sum, message|
content_tag :div, :class => "alert alert-#{types[message[0]]}" do
button_tag('×'.html_safe, :type => 'button', :class => 'close', :'data-dismiss' => 'alert', :name => nil) +
message[1]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment