Capture session expiration in Ruby on Rails

Dave Naffis blogged about this neat plugin that handles all kinds of session manipulation stuff, including the ability to call a method when you expire a session.

This was just what the doctor ordered for me – I had some cleanup code to call on session expiration, and darned if I could figure out how to do this…

With the SessionExpiration plugin it’s a piece of cake

class SomeController < ApplicationController
  expire_session_in 5.minutes, :after_expiration => session_expiry
  def session_expiry
    # Do awesome cleanup operations here!

Daves blog:

Install SessionExpiration like this:

script/plugin install

Subscribe via RSS

Back to all blog posts