There is a callback after_sign_in_path_for , you can add it to your ApplicationController
protected def after_sign_in_path_for(resource) session[:domain_prefix] = current_user.domain_prefix user_path(resource) end
Remember to return the path in the last line of the method, otherwise the callback will redirect the request to the contents of session[:domain_prefix]
source share