Suppose I do
>> a = Annotation.first
>> a.body
=> "?"
>> a.body = "hello"
=> "hello"
Now, I haven't saved a
yet, so in the database its body is still ?
. How can I find out what a
's body was before I changed it?
I guess I could do Annotation.find(a.id).body
, but I wonder if there's a cleaner way (e.g., one that doesn't do a DB query)
From stackoverflow
-
a.body_was
You can also check to see if it's dirty with
a.changed?
and/ora.body_changed?
0 comments:
Post a Comment