Skip to content

Instantly share code, notes, and snippets.

@andreaseriksson
Created May 18, 2013 09:21
Show Gist options
  • Save andreaseriksson/5603841 to your computer and use it in GitHub Desktop.
Save andreaseriksson/5603841 to your computer and use it in GitHub Desktop.
RAILS Bootstrap Flash message
def flash_message(name,msg)
if name == :notice
box_class = "success"
name = "Success"
else
box_class = "error"
name = "Error"
end
link = link_to "x", "", :class => "close", data: { dismiss: "alert" }
content_tag :div, class: "alert alert-#{box_class}" do #alert alert-success
link + raw("<b>#{name.capitalize}: </b> #{msg}")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment