Can I find what time the current session was created?

I want to get the time at which the current session was created. It
doesn’t have to be exact - I’m not worried about the fact that a user
may not actually be on, yet the session is still active. I’d just
like to be able to do
session.created_at

On May 6, 2006, at 8:12 PM, Pat M. wrote:

I want to get the time at which the current session was created. It
doesn’t have to be exact - I’m not worried about the fact that a user
may not actually be on, yet the session is still active. I’d just
like to be able to do
session.created_at

With the Active Record session store and a created_at timestamp
column on the sessions table:
session.model.created_at

jeremy

On 5/6/06, Jeremy K. [email protected] wrote:

jeremy


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

hrm I tried that, but it’s always nil. I’m guessing that Rails
doesn’t manage created_at since Session isn’t actually an AR model.

5 minutes later

I just set the default to be NOW() and it’s working fine. Had to use
a custom execute statement though since the postgresql adapter is
funky with setting default to NOW(). It’d be nice if I could get
Rails to manage the created_at field for me somehow.

Pat