On Oct 15, 10:21 am, Frederick Cheung <[email protected]> wrote: > On Oct 15, 7:49 am, punund <[email protected]> wrote: > > > 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? > > 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
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. -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

