Redirect user after log in only if it's on root_path
问题 I have a root_path on my Rails application that is not user-protected i.e. it's a simple portal homepage, with a login form. After the users log in, I'd like it to go to dashboard_path . I've done this: def signed_in_root_path(scope_or_resource) dashboard_path end This apparently should be used when an user signs in, and I don't want it to go to the root_path , while still keeping the user going back to a previous page if it tries to hit a restricted area and it's either timed out or not