mirror of https://github.com/rails/rails
Add CHANGELOG entry for #14861 and document private methods on the API
This commit is contained in:
parent
bada1d3ed6
commit
b34f7c1706
|
@ -1,3 +1,8 @@
|
|||
* Added `rollback_changes` method to `ActiveModel::Dirty` API to roolback all the
|
||||
changed values to the previous data.
|
||||
|
||||
*Igor G.*
|
||||
|
||||
* Allow proc and symbol as values for `only_integer` of `NumericalityValidator`
|
||||
|
||||
*Robin Mehner*
|
||||
|
|
|
@ -179,19 +179,19 @@ module ActiveModel
|
|||
private
|
||||
|
||||
# Removes current changes and makes them accessible through +previous_changes+.
|
||||
def changes_applied
|
||||
def changes_applied # :doc:
|
||||
@previously_changed = changes
|
||||
@changed_attributes = ActiveSupport::HashWithIndifferentAccess.new
|
||||
end
|
||||
|
||||
# Removes all dirty data: current changes and previous changes
|
||||
def reset_changes
|
||||
# Removes all dirty data: current changes and previous changes.
|
||||
def reset_changes # :doc:
|
||||
@previously_changed = ActiveSupport::HashWithIndifferentAccess.new
|
||||
@changed_attributes = ActiveSupport::HashWithIndifferentAccess.new
|
||||
end
|
||||
|
||||
# Restore all previous data
|
||||
def rollback_changes #:doc:
|
||||
# Restore all previous data.
|
||||
def rollback_changes # :doc:
|
||||
changed_attributes.each_key { |attr| reset_attribute! attr }
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue