Devise with rails 4 authenticated root route not working

前端 未结 3 932
温柔的废话
温柔的废话 2020-12-14 08:45

What I\'m trying to do

I want to send a user to the registrations#new page if they aren\'t logged in.

After you enter login info and click submit, I want y

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-14 09:21

    Do not use routes to do the jobs belonging to controller.

    To redirect an user to certain page after signing up, use Devise built-in after_sign_up_path_for and override it.

    class ApplicationController
      def after_sign_up_path_for(resource)
        faked_user_profile_path(resource)
      end
    end
    

    For routes, I'm not very aware of all of them except devise_for part. But for the redirecting feature, this overriding should be enough.

提交回复
热议问题