Automatically Expiring Sessions

SessionExpiration is plugin that allows you to expire sessions after X seconds of inactivity. Useful for when you want to automatically log out users if they’re idle.

Trac: Subversion repository:


  script/plugin install


  cd vendor/plugins  svn co

Specify when to expire session in your ApplicationController to do it site wide or you can do it for specific controllers:

  class ApplicationController    expire_session_in 5.minutes  end

If you want to run a method when the session expires use this:

  class ApplicationController    expire_session_in 5.minutes, :after_expiration => :some_method  	    def some_method      flash[:notice] = "You have been logged out due to inactivity"    end  end