Search code examples
ruby-on-rails-3deviseoverridingmonkeypatching

how to use monkey patching helper in devise in password controller to change after_sending_reset_password_instructions_path_for


I am using Devise gem and I want to change the redirect path after sending reset password instructions path and I don't want to override the devise controller instead of that I want to use monkey patching helper.

Thanks.


Solution

  • There are several how-to articles on the Devise Wiki that may provide straightforward solutions to the problem you're trying to solve. One might be here: https://github.com/plataformatec/devise/wiki/How-To:-Change-the-default-sign_in-and-sign_out-routes, and another here: https://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-on-successful-sign-in-out

    Note that Devise has gone through a lot of changes recently (new version 2.0 is out) that addresses many of the challenges earlier adopters had through better documentation and by exposing hooks that weren't readily available before. I urge you to consider using the new version. My team dealt with many frustrations and difficulties with the earlier version, and we quickly learned that messing with the internals of Devise frequently had unintended consequences. It's a really great gem, especially its OAuth integration, but it does a lot, and has very clear opinions on how to do things.