Skip to content

Instantly share code, notes, and snippets.

@christianroman
Forked from potomak/_flash.html.erb
Last active December 18, 2015 02:09
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 christianroman/5709417 to your computer and use it in GitHub Desktop.
Save christianroman/5709417 to your computer and use it in GitHub Desktop.
Rails flash messages using Twitter bootstrap 2
<% [:notice, :error, :alert].each do |level| %>
<% unless flash[level].blank? %>
<div class="alert <%= flash_class(level) %>">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<span><%= flash[level] %></span>
</div>
<% end %>
<% end %>
module ApplicationHelper
def flash_class(level)
case level
when :notice then "info"
when :error then "error"
when :alert then "warning"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment