overriding devise after_sign_up_path_for not working

后端 未结 7 1436
刺人心
刺人心 2020-12-15 17:48

In routes i have the root-path pointing \"home#index\" but when i try to override that with after_sign_up_path_for keeps redirecting me to the root path when I

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-15 18:15

    Although I am late to the game, I just ran into this problem and had trouble finding the solution.

    If you are using your own RegistrationsController to customize Devise, then you need to add the after_sign_up_path_for(resource) method to that controller instead of ApplicationController.

    In registrations_controller.rb:

    private
    
      def after_sign_up_path_for(resource)
        new_page_path
      end
    

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

提交回复
热议问题