Tuesday, October 23, 2012

[Rails] Not updating the updated_at field

This is for Rails 3.1.1

I have a field called last_seen in a model. This field will be updated
when the something about the record is seen in the real world (don't
worry about this part)

So I go x.update_attribute(:last_seen, Time.now) and the following happens is

UPDATE "blah" SET "last_seen" = '2012-10-23 08:57:46.179288',
"updated_at" = '2012-10-23 08:57:54.872808' WHERE "blah"."id" = 2673

Now, just for this one attribute, I would like the updated_at field to
be unmolested. Is there some way of updating the last_seen field
without ActiveRecord updating the updated_at field?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate