1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Document reset_changes since it is part of public API

[ci skip]
This commit is contained in:
Rafael Mendonça França 2013-09-23 11:00:41 -03:00
parent 9aa1a3d853
commit 089e1b6426

View file

@ -15,6 +15,8 @@ module ActiveModel
# * Call <tt>attr_name_will_change!</tt> before each change to the tracked
# attribute.
# * Call <tt>changes_applied</tt> after the changes are persisted.
# * Call <tt>reset_changes</tt> when you want to reset the changes
# information.
#
# A minimal implementation could be:
#
@ -36,6 +38,10 @@ module ActiveModel
# # do persistence work
# changes_applied
# end
#
# def reload!
# reset_changes
# end
# end
#
# A newly instantiated object is unchanged:
@ -59,6 +65,12 @@ module ActiveModel
# person.changed? # => false
# person.name_changed? # => false
#
# Reset the changes:
#
# person.previous_changes # => {"name" => ["Uncle Bob", "Bill"]}
# person.reload
# person.previous_changes # => {}
#
# Assigning the same value leaves the attribute unchanged:
#
# person.name = 'Bill'