You''ve already said that you destroy sessions when they log in if the
session still exists... so just don''t destroy the session when someone
logs
out. You''re left with an idle session that exists until the next time
they
log in this way, but you can always set up some kind of scheduled thing
(varies depending on OS) that will go in and clean up any sessions that
haven''t had activity in <X> amount of time.
On 2/23/07, Scott Holland
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
>
>
> Hello Guys,
>
> I have an application which lets users login . In order to see how many
> users are online (active in the last 20 mins) I have a before_filter on
> every page which updates a column in the user table called
> "last_hit_server"
>
> This is a little silly and is really slowing things down.
>
> Here are my aims:
>
> I need to create a list of all the users active in the last 20 mins
> I need to be able to see when a user was ''online''
>
>
> Obviously I need to start tracking sessions, but I really need some help
> with the logic of it
>
> Here is what I''m thinking so far
>
>
>
----------------------------------------------------------------------------
>
> * When they log in I first check to see if there is a session already
> assigned to that user
> * (If there is I destroy it)
> * I then create a new session and assign the user id to it.
>
>
> "Who''s online": I can then pull out a list of all the
sessions which
> have been updated in the past 20 mins along with the user id
>
> When they log out, I destroy the session
>
>
>
----------------------------------------------------------------------------
>
>
> But this doesn''t solve my problem of seeing when a person was last
> ''online'' if I have destroyed the session
>
> Any suggestions?
>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---