Ideally, you want to add something like this to environment.rb:
session :session_expires => 1.day.from_now
But this will not work, because the code is run only once at the start of the APP and thus the next day all your sessions are created with expiration in the past.
I usually set session_expires for some time in the future (6 months). Then manually set and check the date of session[:expires] in before_filter on my application controller and reset the session when that date has passed.
This makes it VERY easy to add the "Remember me for ___" parameter when logging in, you just set session[:expires] = Time.now + ___
Daniel Beardsley Oct 30 '08 at 17:54 2008-10-30 17:54
source share