Reputation: 659
I want to add a redirect
after sign_in
in the new_user_session
path.
My helper methods:
def redirect_back_or(default)
debugger
redirect_to(session[:return_to]||default)
session.delete(:return_to)
end
def store_location
session[:return_to]=request.fullpath if request.get?
end
This is for an e-bank website that receives data from other websites and redirects to the new_user_session path asking for the user to sign in. I set-up Devise with default User model. Thanks.
Upvotes: 0
Views: 52
Reputation: 3323
You can override the devise session controller like this
class Users::SessionsController < Devise::SessionsController
#In this method check your logic
def after_sign_in_path_for(resource)
#check your specific situation here and do whatever you want
if condition meet
##your logic goes here
else
root_path // or redirect after logged in
end
end
end
Upvotes: 1