mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
80989437dc1502f9194b0600941b6d70a3efa3b2
after a model had been saved. This is useful in the after_save callback
when you need to know what fields changed. At present there is no way
to do this other than have code in the before_save callback that takes
a copy of the changes Map, which I thought was a bit messy.
Example.
person = Person.find_by_name('bob')
person.name = 'robert'
person.changes # => {'name' => ['bob, 'robert']}
person.save
person.changes # => {}
person.previous_changes # => {'name' => ['bob, 'robert']}
person.reload
person.previous_changes # => {}
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Description
No description provided
Languages
Ruby
97.9%
CSS
1.5%
HTML
0.5%