# Syntax of session's updated\_at field?

**URL:** <https://www.ruby-forum.com/t/syntax-of-sessions-updated-at-field/196594>\
**Category:** Rails\
**Created:** [February 12, 2008, 6:18pm UTC](https://www.ruby-forum.com/t/syntax-of-sessions-updated-at-field/196594 "2008-02-12T18:18:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [February 12, 2008, 6:18pm UTC](https://www.ruby-forum.com/t/syntax-of-sessions-updated-at-field/196594/1 "2008-02-12T18:18:47Z")

</div>

What’s the syntax to acquire the updated\_at value of a session stored  
in a db?

session.updated\_at doesn’t work. can’t find any docs on this.

– gw

---

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [February 12, 2008, 6:37pm UTC](https://www.ruby-forum.com/t/syntax-of-sessions-updated-at-field/196594/2 "2008-02-12T18:37:14Z")

</div>

On 12 Feb 2008, at 17:06, Greg W. wrote:

> What’s the syntax to acquire the updated\_at value of a session stored  
> in a db?
> 
> session.updated\_at doesn’t work. can’t find any docs on this.

I think you might just have to do it by hand - the session object is  
what you get from unmarshaling the blob of data from one column of the  
session table - the rest of the session table doesn’t make it past  
that level.  
You do get session.session\_id to assist you with that.

Fred

---

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [February 12, 2008, 6:47pm UTC](https://www.ruby-forum.com/t/syntax-of-sessions-updated-at-field/196594/3 "2008-02-12T18:47:18Z")

</div>

On Feb 12, 2008, at 9:36 AM, Frederick C. wrote:

> it past that level.  
> You do get session.session\_id to assist you with that.

Odd that updated\_at wouldn’t be included, but OK, I can make my own  
session object interface then. Thanks.

– gw

---

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [February 14, 2008, 3:03am UTC](https://www.ruby-forum.com/t/syntax-of-sessions-updated-at-field/196594/4 "2008-02-14T03:03:40Z")

</div>

On 12 Feb 2008, at 17:46, Greg W. wrote:

> > I think you might just have to do it by hand - the session object  
> > is what you get from unmarshaling the blob of data from one column  
> > of the session table - the rest of the session table doesn’t make  
> > it past that level.  
> > You do get session.session\_id to assist you with that.
> 
> Odd that updated\_at wouldn’t be included, but OK, I can make my own  
> session object interface then. Thanks.  
> Turns out i was wrong, saw this today from jeremy:

---

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [February 14, 2008, 5:08am UTC](https://www.ruby-forum.com/t/syntax-of-sessions-updated-at-field/196594/5 "2008-02-14T05:08:32Z")

</div>

On Feb 13, 2008, at 6:02 PM, Frederick C. wrote:

> > > is what you get from unmarshaling the blob of data from one column  
> > > of the session table - the rest of the session table doesn’t make  
> > > it past that level.  
> > > You do get session.session\_id to assist you with that.
> > 
> > Odd that updated\_at wouldn’t be included, but OK, I can make my own  
> > session object interface then. Thanks.

> Turns out i was wrong, saw this today from jeremy:
> 
> > You can use session.model to get at the underlying session record.
> > 
> > You can even reopen CGI::Session::ActiveRecordStore::Session to add  
> > associations if you like.

Yeah, I just spotted the long version in The Rails Way last night,  
but .model is even better:

session.model.updated\_at

gives me exactly what I wanted. 🙂

– gw
