Removing session file from filesystem upon logout

Why not look into storing your sessions in the database?

http://wiki.rubyonrails.org/rails/pages/HowtoChangeSessionStore

Regards

Dave M.

You can do that if you've got sessions stored in the database. When the user logs out, simply delete the record corresponding to that user's session.

Failing that, you can build some sort of "reaper" method to walk through the table periodically and remove any sessions that have become older than some predefined limit (e.g. 2 hours). This would work fine for sessions stored in the file system as well, but I think it's easier and safer to just delete the session record from the DB when the user logs out.

Regards

Dave M.

You can do that if you've got sessions stored in the database. When the user logs out, simply delete the record corresponding to that user's session.

How could I do that?. I store sessions on database. When the user logs out, I do

reset_session

but I've tried delete the session doing session.destroy but it raises an exception because CGI::Session doesn't have that method. Do I need to delete the session with an explicit SQL sentence?

Try "puts session.inspect", it will show you all the fun attributes of the session. Usually a good first step in answering any question is to invoke the 'inspect' method on the object in question as it can tell you a lot about what's available to you

Yan

http://planyp.us