Removing stale active record sessions

I have an application that is used by only a small number of persons.
This app stores its sessions in the database. When the user logs out,
the session is removed, but of course, there is always the possibility
that the user will forget to logout, and the session will go stale.

In other webapps, I have used a sweeper ruby script that I run as a
cron job to periodically clean these out. But I was wondering about
incorporating this functionality into the login controller, so that
every time a user logs in, it sweeps for out of date sessions.

Is this a good idea? It seems easier than having a sweeper script.

But I don’t know how to do that with rails code. Any ideas?

Thanks,
Shelby

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs