Method: ActiveModel::Dirty#previous_changes

Defined in:
activemodel/lib/active_model/dirty.rb

#previous_changesObject

Returns a hash of attributes that were changed before the model was saved.

person.name # => "bob"
person.name = 'robert'
person.save
person.previous_changes # => {"name" => ["bob", "robert"]}


363
364
365
# File 'activemodel/lib/active_model/dirty.rb', line 363

def previous_changes
  mutations_before_last_save.changes
end