Redirect User to Signup

前端 未结 5 953
没有蜡笔的小新
没有蜡笔的小新 2021-02-05 20:47

Using before_action :authenticate_user! to check if user logged in. But it sends users to login instead of signup.

Tried different

5条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-05 21:28

    This is very simple

    User store_location_for method

    Like

    before_filter :auth_user
    
    def auth_user
      unless user_signed_in?
        store_location_for(:user, request.fullpath)
        redirect_to new_user_registration_url 
      end
    end
    

提交回复
热议问题