module ActiveModel::Dirty

def previous_changes

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

Returns a hash of attributes that were changed before the model was saved.
def previous_changes
  mutations_before_last_save.changes
end