I am trying to override the Devise method set_flash_message
. Devise documentation covers how to override controllers for the various submodules.
However this particular method is located within DeviseController
, the parent class of all the modules.
The documentation (both wiki and inline) says nothing about how to achieve this, so I'm not sure how best to proceed. I believe the best approach would be to simply re-open the class and modify the method as needed, and I placed a file in /lib
to that effect. However it appears that is getting loaded prior to Devise, resulting in error spew.
NameError in Devise::RegistrationsController#new
undefined local variable or method `require_no_authentication' for #<Devise::RegistrationsController>
The complex parent definition for DeviseController
may also be having an net negative effect:
class DeviseController < Devise.parent_controller.constantize
Thoughts?
Devise.parent_controller
is defined in the Devise module definition in devise/devise.rb
. Luckily, it has mattr_accessor
declared, so you can set the value yourself (the default value is "ApplicationController"). It probably makes the most sense to do this some time in your application initialization process, for example, along with the rest of the Devise configuration in initializers/devise.rb
.
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