Forum: Ruby on Rails Rails 2.3 deleting sessions

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jay (Guest)
on 2009-03-19 15:42
(Received via mailing list)
The following line no longer works in 2.3:

ActiveRecord::SessionStore.delete_all ['updated_at < ?', 24.hours.ago]

Does anyone know how to do this in 2.3?

Thanks,
Jay
Robert W. (Guest)
on 2009-03-19 16:07
Jay wrote:
> The following line no longer works in 2.3:
>
> ActiveRecord::SessionStore.delete_all ['updated_at < ?', 24.hours.ago]
>
> Does anyone know how to do this in 2.3?

Do you really need to go though Rails to do this? I think I would just
write a simple script and execute it in a cron task to clear out old
sessions.

As far as I can tell, as long as the sessions fit the criteria for
cookie based session stores, it seems to me like a very clean way to
deal session data. That way the server and database are relieved from
the burden of dealing with sessions.

I am also looking forward to the day when it becomes feasible to use
HTML 5.0 local storage to keep session data. I believe this will be the
final solution to dealing with persistent data for web applications. It
eliminates the current limitations of cookie based sessions while
simultaneously pushing state related information out to the client-side
where, IMHO, it belongs.
Gianluca T. (Guest)
on 2009-03-19 16:51
(Received via mailing list)
Ouch, you're right !

I've the same problem, I watch the API and solved !

Try this:

ActiveRecord::SessionStore::Session.delete_all ['updated_at < ?',
24.hours.ago]

Have fun !
This topic is locked and can not be replied to.