Auto timeout sessions in Rails

Time Out!I released the initial version of my auto-session-timeout plugin for Rails at West End Ruby tonight.

Have you ever wanted to force your users off your app if they go idle for a certain period of time? Many online banking sites use this technique. If your app is used on any kind of public computer system, this type of functionality is essential for maintaining the privacy of your data.

After installing the plugin, a small snippet of JavaScript is placed on each page. The JS polls the server every minute to see if the session is still active. If the user has been idle for at least an hour, they are immediately redirected to a timeout page. The session will not timeout as long as the user keeps clicking around. The timeout and polling intervals are both configurable.

The plugin is dead simple to install and configure. To get started:

script/plugin install git://

Then hit the README for step-by-step instructions.

2 thoughts on “Auto timeout sessions in Rails

  1. Pingback: Double Shot #467 « A Fresh Cup

  2. The forced thing is an idea I gave up on with rails. The thing is many folks (on my site anyway) will stay seemingly idle but will come back later.

Comments are closed.