How to list all sessions?

I have created ActiveRecord session store in a rails 3 project:

rake db:sessions:create
rake db:migrate

then

Myapp::Application.config.session_store :active_record_store, :key =>
‘_myapp_session’

in initializers/session_store.rb and it all works.

Now the question: how do I list ALL active sessions?

On Oct 15, 7:49am, punund [email protected] wrote:

in initializers/session_store.rb and it all works.

Now the question: how do I list ALL active sessions?

If you want to be completely accurate you can’t: you’ll have a row
corresponding to a particular session, but you can’t tell if that
person has since quit their browser. Or they could still have your
site open but not actually be sitting at their computer. If you
sessions table has an updated_at column you will get when their
session last changed which is probably a reasonable approximation. Why
do you care?

Fred

On Oct 15, 10:21am, Frederick C. [email protected]
wrote:

‘_myapp_session’
session last changed which is probably a reasonable approximation. Why
Imagine a chat room, where all (more or less) active users are listed.
I don’t need them to log in, and I don’t care if they quit the
browser, a background worker would purge inactive sessions.
I also understand that I can query the “sessions” table, I was just
wondering if there is a more abstracted way of doing this in Rails.