Need User All login and logout times

Hello everyone,

I need user All login and logout time. not only last login and logout time.

I am using rails 3.2.8 + devise gem for User.

Is there any way to get all time?

Saravanan.

http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Trackable

Hi Dheeraj

Thanks for reply.

In Trackable, i can only see total sign in count, last sign in time and sign out time…

But I need, users all sign in and sign out time stamp.

Is there any way?

I can implement this by adding records in separate table by devise “after sign in” and “after sign out” method. But i think its not good idea to get that.

Why don’t you think its a good way?

May be if your open private window and signin.

Then without signout, the user close browser my code (i.e “after sign out” method) will not run and i cant get sign out time… thats why i said…

Why don't you think its a good way?

-- Dheeraj Kumar

Hi Dheeraj

Thanks for reply. In Trackable, i can only see total sign in count, last sign in time and sign out time... But I need, users all sign in and sign out time stamp. Is there any way?

For past logins and logouts, there's no other way to get it other than

parsing the log files. But I think that's no easy task plus you usually don't have info on who logged in and out in the logs so that may also be impossible.

I can implement this by adding records in separate table by devise "after sign in" and "after sign out" method. But i think its not good idea to get that.

this is probably the best way to get what you want

Good luck!

May be if your open private window and signin. Then without signout, the user close browser my code (i.e "after sign out" method) will not run and i cant get sign out time... thats why i said...

you can get around this by using javascript and ajax. Look at before

Ok Thanks for the reply Dheeraj Kumar and Jim Ruther Nill.