session expire

Hi all,

I have set a session session to expire after an hour by doing:   session[:expire] = { :expires => 1.hour.from_now } What I would like to do is have it so that session gets reset back an hour whenever a new page is loaded. If, however, the session variable has expired and the user tries to load a page I want my app to kick them back to a loggin page. I have tried to achieve this by saying:

  if !(session[:expire].blank? < 0.hour.from_now)     session[:expire] = { :expires => 0.25.hour.from_now }   end

However, it doesn't like the session[:expire]. It gives me:

You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.

even though I am saying if session is blank. Is there another way to do this. Thanks,

-S

Have a look at the sliding_session_timeout plugin:

Chris Bartlett wrote:

Have a look at the sliding_session_timeout plugin: http://www.elctech.com/2007/10/29/sliding-session-timeout

On Jun 28, 3:10�am, Shandy Nantz <rails-mailing-l...@andreas-s.net>

session :session_expires => 10.minutes.from_now

jst do this in ur application.rb and it will be applicable to ur whole application..It will work the same way u want.. no need to do necoding for it

Hope this helps

Thanks

Dhaval Parikh Software Engineer Ruby on Rails

sales(AT)railshouse(DOT)com