Hello I am new to ruby on rails and I am struggling to understand I18n\'s flash messages. I am using devise, rails 4, and twitter bootstrap.I understand that devise only use
The simplest solution I've found is to use a common partial for all flash messages while checking for :notice and :alertto replace with the necessary bootstrap class.
So make /views/shared/_alerts.html.erb like this -
<% flash.each do |message_type, message| %>
<% end %>
Add a helper method (I've added it to the application helper) like this -
def flash_class_name(name)
case name
when "notice" then "success"
when "alert" then "danger"
else name
end
end
Include _alerts.html.erb in the application layout (or the parent layout for your application).
That's it!