I want to change the keys Devise is using in flash alerts. (Devise uses
:notice and :alert flash keys, but I want to change them to :success and
:error so that I can display nice green/red boxes with Bootstrap.)
To that end, I want to monkey patch the `set_flash_message` method in
DeviseController<https://github.com/plataformatec/devise/blob/270e2ece19f20fdbb349b8130c31acc5b222fabb/app/controllers/devise_controller.rb>
.
I created a file called *config/initializers/overrides.rb* that contains
the following:
class DeviseController> def set_flash_message(key, kind, options = {})
>
> if key == ''alert''
> key = ''error''
> elsif key == ''notice''
> key = ''success''
> end
>
> message = find_message(kind, options)
> flash[key] = message if message.present?
>
> end
> end
But now I get the following error on any Devise-related action:
*Routing Error: undefined method `prepend_before_filter'' for
Devise::SessionsController:Class*
What am I doing wrong?
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/b1a19ef0-731e-492a-9a92-0ab5275cecbb%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.