sessions

If I set every user's session[:user_id] = user.id (model object.id) and
saved it in activerecord table sessions, how would I extract everyone's
session[:user_id] from the sessions table, so I can display who's
online?

Or is there a better way?

Thanks!

If I set every user's session[:user_id] = user.id (model object.id)
and
saved it in activerecord table sessions, how would I extract
everyone's
session[:user_id] from the sessions table, so I can display who's
online?

with difficulty - the database just contains a Marshal.dump
representation of the data, so you can't query for it.
You'd probably be better off just updating the users table with a
'last_seen_at' timestamp. Or add a user_id column to the sessions
table (access it via session.model if i recall correctly).

Fred

Sounds good Fred, that was my thought initially, thought there might be
a more elegant way to implement it.

Thanks!!