@article.update_attributes :updated_at => 10.minutes.ago
Then you'll have your updated_at field set to Time.now whatever you pass in it, because ActiveRecord will overwrite it by default.
The answer is simple, use the 'record_timestamps=' class-method which switches on/off the automatic updating of the created and updated fields.
Article.record_timestamps = false
@article.update_attributes :updated_at => 10.minutes.ago
Article.record_timestamps = true
That's it.
1 comment:
Thanks! I was trying to update this field on my functional test and your post saved my day.
Post a Comment