# Session Experassion

**URL:** <https://www.ruby-forum.com/t/session-experassion/141343>\
**Category:** Rails\
**Created:** [June 24, 2008, 9:33pm UTC](https://www.ruby-forum.com/t/session-experassion/141343 "2008-06-24T21:33:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [June 24, 2008, 9:33pm UTC](https://www.ruby-forum.com/t/session-experassion/141343/1 "2008-06-24T21:33:29Z")

</div>

I have been trying to figure out a way to get a session to expire after  
an hour. I did a search and came up with the following code:

session[:user] = { :expires =\> 1.hour.from\_now }

My app runs when I put this code in but after an hour of being idle  
nothing happened. I’m not sure what I expected to happen, but what I  
thought might happen is that after an hour the session would no longer  
be in a valid state and as I tried to navigate to another page I would  
be automatically signed out. But this didn’t happen. Is there anyone who  
has experence doing this and can you give me some hints? Thanks,

-S

---

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [June 24, 2008, 9:57pm UTC](https://www.ruby-forum.com/t/session-experassion/141343/2 "2008-06-24T21:57:03Z")

</div>

take a look here:

[http://squarewheel.wordpress.com/2007/11/03/session-cookie-expiration-time-in-rails/](http://squarewheel.wordpress.com/2007/11/03/session-cookie-expiration-time-in-rails/)
