Skip to content

Instantly share code, notes, and snippets.

@lgs
Forked from nacengineer/application_helper.rb
Created May 24, 2012 22:34
Show Gist options
  • Save lgs/2784628 to your computer and use it in GitHub Desktop.
Save lgs/2784628 to your computer and use it in GitHub Desktop.
Flash Messages with Bootstrap 2 and Rails 3.2.3
# in application_helper
def flash_class(level)
case level
when :notice then "alert alert-info"
when :success then "alert alert-success"
when :error then "alert alert-error"
when :alert then "alert alert-error"
end
end
# app/views/layouts/application.html.haml
= render "layouts/flash_messages"
# layouts/_flash_messages.haml
- flash.each do |type, message|
%div{:class => "fade in #{twitterized_type(type)}" }
%button{:class => 'close', 'data-dismiss' => 'alert'} ×
= message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment