Method: Mongoid::Dirty::InstanceMethods#previous_changes
- Defined in:
- lib/mongoid/dirty.rb
#previous_changes ⇒ Object
Gets all the modifications that have happened to the object before the object was saved.
Example:
person = Person.new(:title => "Sir")
person.title = "Madam"
person.save!
person.previous_changes # returns { "title" => [ "Sir", "Madam" ] }
Returns:
A Hash of changes before save.
141 142 143 |
# File 'lib/mongoid/dirty.rb', line 141 def previous_changes @previous_modifications end |