How to redirect to a specific page on successful sign up using rails devise gem?

后端 未结 3 1601
遇见更好的自我
遇见更好的自我 2021-01-14 09:23

How to redirect to a specific page on successful sign up using rails devise gem?

相关标签:
3条回答
  • 2021-01-14 09:49

    This page is for you: http://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-on-successful-sign-in

    0 讨论(0)
  • 2021-01-14 09:49

    I hope its not too late, you need to override the after_sign_up_path_for of the registration controller, create a registrations_controller.rb in your app/controller, and override said action.

    registrations_controller.rb

    class RegistrationsController < Devise::RegistrationsController
    
      def after_sign_up_path_for(resource)
        ...path of choice...
      end
    
    end
    

    haven't tested this code so might not work with just copy and paste. If you look here it will give you the actions for any other redirects you made need.

    https://github.com/plataformatec/devise/blob/master/app/controllers/devise/registrations_controller.rb

    0 讨论(0)
  • 2021-01-14 09:56

    The wiki page recently moved and the info is here: https://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-on-successful-sign-in-and-sign-out

    0 讨论(0)
提交回复
热议问题