Session modify user updated_at

I have a system that uses sessions for users to display their
personalized site. I want to modify the updated_at field in the
database when ever their personal account is viewed. Any ideas?

Thank you,

Sean McGilvray

Personally I’d use a last_visited field instead, since the record wasn’t
actually updated.
That said, maybe this will help for what you’re asking to do:

On Thu, Jun 18, 2009 at 11:32 AM, Sean McGilvray
[email protected]wrote:

I have a system that uses sessions for users to display their
personalized site. I want to modify the updated_at field in the
database when ever their personal account is viewed. Any ideas?

Thank you,

Sean McGilvray


Christopher W.
[email protected]
612.424.9880

How would you implement the last_visited?

Sean McGilvray
Executive Recruiter
Identity Theft Specialist
Pre-Paid Legal Service’s, Inc. NYSE:PPD
Phone: 760-486-1019
[email protected]
http://www.transferhome.net

On Thu, Jun 18, 2009 at 9:55 AM, Christopher W. <

You say you’d like to track when their account was last viewed. Do you
mean
viewed by the user, or viewed by someone else?
That said, if it’s by the user, update last_visited when the user logs
in.
If it’s someone else, update last_visited when the view is loaded to
show
that user’s information. You could run in to some trouble with that if
you
start doing page caching, though.

On Thu, Jun 18, 2009 at 12:54 PM, Sean McGilvray
[email protected]wrote:


Christopher W.
[email protected]
612.424.9880

On Jun 18, 6:54 pm, Sean McGilvray [email protected] wrote:

How would you implement the last_visited?

As Sean says, it sounds like you’re looking for a field that’s
somewhat different to what updated_at is supposed to represent.

To track the visit information, you could add a last_visited datetime
to your model. You would add the code:

@user.update_attribute(:last_visited, Time::now)

to the action that you wanted to record access to. You can also do the
same with the updated_at field if you prefer.

-Matt