instance method
previous_changes
Ruby on Rails 4.1.16
Since v3.0.20Signature
previous_changes()
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"]}
Source
# File activemodel/lib/active_model/dirty.rb, line 138
def previous_changes
@previously_changed ||= ActiveSupport::HashWithIndifferentAccess.new
end
Defined in activemodel/lib/active_model/dirty.rb line 138
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::Dirty