Topic: Show users logged in

When a user logs into my app I store their ID in a session variable. Is there a way for my app to read all sessions so I can display a list of users logged in?

Re: Show users logged in

I know Beast does this, but I'm not exactly sure how. I suggest taking a look at the source code and see if you can make anything out of it. Maybe someone else here has experience with this.

Last edited by ryanb (2006-11-09 16:14:03)

Railscasts - Free Ruby on Rails Screencasts

Re: Show users logged in

This article should help smile

vinnie - rails forum admin

Re: Show users logged in

Ok, so it looks like it can be a hairy issue. Think I'll punt for now. Thanks for the guidance.

Re: Show users logged in

I have managed to solve this problem in one of my apps.  I have posted the solution on my blog here http://matt-beedle.com/2006/12/13/rails … is-online/.  I hope this helps.

Regards,

Matt

Re: Show users logged in

I am probably neglecting some aspect of this problem since I've never tried it myself, but couldn't you just use application variables with @@, like @@array_of_user_names?

Re: Show users logged in

More often than not, users simply navigate away from your site without logging off, so your list gets out of sync.  Also, in distributed applications you can end up with two separate lists.  See the following for more discussion on this matter: http://rails.techno-weenie.net/forums/1/topics/17