[Ruby] user is online in Rails
Eric Hodel
drbrain at segment7.net
Wed Dec 6 11:32:41 PST 2006
On Dec 6, 2006, at 07:57 , ben wiseley wrote:
> We wanted to have something that showed when someone is online on
> our site
> (like they do on many of those PHP forums). How do you pull this
> off in
> Rails?
>
> In .Net there's a session end event you can work with.
>
> Anything exist like that in Rails?
I would use a memcache key like "user:#{user.id}:last_login" that
stores a timestamp. Update the timestamp every time a user hits a
page. A user is 'online' if you've seen them in the last N seconds.
--
Eric Hodel - drbrain at segment7.net - http://blog.segment7.net
I LIT YOUR GEM ON FIRE!
More information about the Ruby
mailing list