Syed Raza Syed Raza - 1 year ago 556
Ruby Question

I want to override authenticate_user and current_user method of devise gem

I want to override authenticate_user! and current_user method of devise gem in my application Controller can you please help me with regards to that
Thanks

Answer Source

You may be able to monkey-patch it like:

module Devise
  module Controllers
    module Helpers
      def authenticate_user!
        #do some stuff
      end
    end
  end
end   

But I would ask what the ultimate goal is, because Devise has some customizability built into it already, and overriding these methods makes me wonder "why use Devise at all?"

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download