Difference between current_sign_in_at and last_sign_in_at ?

4,114 views
Skip to first unread message

Nick Hoffman

unread,
Sep 5, 2011, 12:13:06 AM9/5/11
to plataforma...@googlegroups.com
Hey folks. What's the difference between these 2 fields?
current_sign_in_at
last_sign_in_at

They always seem to be the same, regardless of whether a user's logged-in or logged-out.

Thanks,
Nick

Kulgar

unread,
Sep 5, 2011, 5:08:26 AM9/5/11
to Devise
Hi :)

It seems that they are different when an user's profile is updated.
For instance for one of my users :
current_sign_in_at equals updated_at

And last_sign_in_at equals (almost) created_at (cause that was my only
first sign_in).

Maybe last_sign_in_at equals current_sign_in_at as long as the
database records of the user are not changed.

Nick Hoffman

unread,
Sep 5, 2011, 9:25:26 AM9/5/11
to plataforma...@googlegroups.com
Ah, I follow you. Thanks for the tip, Kulgar.

current_sign_in_at is the user's latest sign-in.
last_sign_in_at is the user's second-last sign-in.

I guess that's useful if you want to determine the length of time between their current and last sign-in.
Reply all
Reply to author
Forward
0 new messages