1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

2 commits

Author SHA1 Message Date
Josh Sharpe
80989437dc I added this feature so that a Map of changed fields could be retrieved
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>
2009-08-31 12:50:27 -05:00
Joshua Peek
f97dae5ebe Extract common dirty tracking methods in AMo 2009-08-10 13:51:48 -05:00