I have a process which iterates through a bunch of ActiveRecord models, does some processing, and saves the models again. Often though, the processing doesn't result in an changes to the attributes and so the updated_at
column never changes (even though save is called).
I'd prefer not to disable partial updates (in general, they're useful). I'm guessing that my two options are to:
- Add a separate timestamp column to the model (i.e., '
processed_at
') and manage this myself, although this seems a bit wasteful/redundant.
- Or somehow override the management of the
updated_at
attribute?
I've heard that Rails 3 will have a 'touch' method which would be exactly what I'm looking for.
Any ideas/options/opinions?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…