| Path: | README |
| Last Update: | Mon Mar 24 17:25:14 +0100 2008 |
This plugin allows to check when the current session will expire based on the updated_at column of the sessions-table. Sessions will not expire automatically, you have to handle them by yourself.
ruby script/plugin install http://expire-sessions.rubyforge.org/svn/trunk/expire-sessions/
Somewhere in a controller (probably a authentication before_filter):
if session.expired? reset_session flash[:warning] = 'Your session has expired' end
You can set the lifetime of your sessions. This is an application-wide setting and should be placed in an initializer.
CGI::Session.lifetime = 20.minutes
You can also remove all expired sessions from the database by calling
CGI::Session.delete_expired
directly in your code, or by using the provided rake-task
rake db:sessions:delete_expired RAILS_ENV=production
It is very much recommended to set RAILS_ENV when using the rake-task.