how to stay on page after login ?


I have one questions, how to stay on page after login ? should i create session url or something else ?


If you use something like devise… it’s more or less done for you.

I don’t use devise

The way Devise does this (in broad terms) is that on any page where you check for authentication (before_action :authenticate_user!) that method first checks to see if you are already signed in, if not, it stores the location of the page where you are in a cookie, then redirects you to the new session path, if you are successful in authenticating, then the session create method removes your original destination from the cookie, and redirects you there.