Skip to content

Instantly share code, notes, and snippets.

@adamloving
Created February 19, 2013 19:32
Show Gist options
  • Save adamloving/4989057 to your computer and use it in GitHub Desktop.
Save adamloving/4989057 to your computer and use it in GitHub Desktop.
Applies Twitter bootstrap styles to rails flash messages. Add this to your application layout with = render 'layouts/flash', :locals => { :flash => flash } To quote http://stackoverflow.com/questions/5798791/what-is-the-difference-when-using-flash-error-alert-and-notice "The semantics of what or when to use :alert/:error/:notice are really up to…
- if locals[:flash]
- flash = locals[:flash]
- if flash[:warn] || flash[:alert]
.alert #{flash[:warn]} #{flash[:alert]}
- if flash[:notice] || flash[:success]
.alert.alert-success #{flash[:notice]} #{flash[:success]}
- if flash[:info]
.alert.alert-info #{flash[:info]}
- if flash[:error]
.alert.alert-error #{flash[:error]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment