Back to Blog

Get in Touch

Automatically Expiring Sessions

By Dave Naffis June 4, 2007 in

Missing

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.

Installation:

script/plugin install http://svn.intridea.com/svn/public/session_expiration

OR

cd vendor/plugins
svn co http://svn.intridea.com/svn/public/session_expiration

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
Medium

Dave Naffis

David is an entrepreneur and software developer with demonstrated experience in software services, product development, strategy, and operations. He is a co-founder of Intridea, an Inc 500 winning software development firm where he oversaw several successful product spinouts. Before starting Intridea, Dave ran his own Ruby on Rails consultancy and worked as a software engineer and architect at companies including AOL, Cisco, and McKinsey. He holds a masters in Systems Engineering from The University of Virginia, has contributed to a number of open-source projects, and has spoken at numerous regional and national conferences.

More from our blog

Welcome to Intridea

Read Now →
X

More posts by Dave Naffis

Dave Naffis

Four years ago, what started as a team of three people with a conviction t...

Dave Naffis

In this new blog series, Why Your Company Needs a Rails Development S...

Dave Naffis