Rails 3.1 and Devise 1.5 question.
I'm using the following code to display flash messages in my layout:
<% flash.each do |key, message| %>
<%= content_tag(:div, message, :class => "flash #{key}") %>
<% end %>
I'd like to change the css class for some of my confirmation messages from notice to success, but I don't know where to override or change the key because I don't know where it's set.
Can anybody point me in the right direction?
Thanks!
So the way to do this is to edit the devise controllers.
When you install Devise through the normal installation I don't think it install the controllers (at least it didn't for me).
So first you should manually add the controller files and put them into your project in the same location: https://github.com/plataformatec/devise/tree/master/app/controllers/devise
Once you have the files in your project, go to the "sessions_controller.rb" file.
One lines 16 & 25, you should see the code:
set_flash_message :notice, :signed_in
and
set_flash_message :notice, :signed_out
You just need to change ":notice" to ":success"
Hope that works!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With