简体   繁体   中英

Rails / Devise / Link to login page and pass it a redirect route to use after successful login

How can I link to the devise login page and pass it a specific redirect_to route for a successful login. (the specific route has to change -> so overriding Devise RegistrationsController is not the proper option, or it has to be dynamic ...)

or

How can I add a redirect url to Devise new_user_session_path()

Got it working by using store_location_for(:user, jobs_path) unless user_signed_in? in the index method

class JobsController < ApplicationController

    def index
        store_location_for(:user, jobs_path) unless user_signed_in?
        ...
    end
end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM