I have created ActiveRecord session store in a rails 3 project:> rake db:sessions:create > rake db:migratethen 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? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Oct 15, 7:49 am, punund <i...-JxkvJIXwMpM@public.gmane.org> 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 do you care? Fred -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
On Oct 15, 10:21 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Oct 15, 7:49 am, punund <i...-JxkvJIXwMpM@public.gmane.org> 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. WhyImagine 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Possibly Parallel Threads
- Switching to ActiveRecord Session Store
- active_record_store sessions does not pass a :secret to #protect_from_forgery in Rails 2.0.0 Preview
- Switching to active_record_store session management errors out
- Session (stored in db) not working in testing mode
- Cookie Overflow at CSV import