module ActiveModel::Dirty

def previous_changes

person.previous_changes # => {'name' => ['bob, 'robert']}
person.save
person.name = 'robert'
person.name # => 'bob'
Map of attributes that were changed when the model was saved.
def previous_changes
  @previously_changed
end