On 5/19/06, Rimantas L. firstname.lastname@example.org wrote:
I don’t think there’s a built-in way to do that…but it seems like
it’d be pretty simple.
Returns true if this object hasn’t been saved yet ? that is, a record
for the object doesn’t exist yet.
From the OP:
“this object was the one that was originally persisted”
new_record? tells you if the object hasn’t been saved. OP is asking
how to tell if the record is the original one. My interpretation is
basically that the object hasn’t been modified at all. The easiest
way to do that (though perhaps not fool-proof) is to compare the
updated_at and created_at fields. In fact, I used new_record? in my
Another possibility is acts_as_versioned, which may be more air-tight
than my solution (though I don’t know if there are any problems with
it, I just came up with it).