I’m looking for a solution, to reach the desired behaviour.
Running a Rails3 application where authentication is handle by Devise. I want to detect any user coming back to the site while already signed in (with the remember_me cookie).
My aim is to redirect him to a specific page (as I already do it on after_sign_in_path_for).
My very problem is not to detect if a user is signed_in?, but to be sure he wasn’t navigating on the site just tow minutes before (I prefer to avoid strategy based an time…)
Any guess ?
My own answer, to my question…
I posted the question too quickly.
The solution is quite simple, Rails create a session cookie after each request, we just need to check if it exists or not :
I was mixing Devise session wich can subsiste between browser closings, and session cookie which are destroyed after each browser closing.
user_returning?allow me to know if a user is coming back to the site, while he is already signed in…