Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Document reset_changes since it is part of public API

[ci skip]
  • Loading branch information...
commit 089e1b6426719ad5132153323d23798094d271fa 1 parent 9aa1a3d
@rafaelfranca rafaelfranca authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 activemodel/lib/active_model/dirty.rb
View
12 activemodel/lib/active_model/dirty.rb
@@ -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
@bogdan
bogdan added a note

It is reload! in the class definition.

@rafaelfranca Owner

Fixed. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ # person.previous_changes # => {}
+ #
# Assigning the same value leaves the attribute unchanged:
#
# person.name = 'Bill'
@bogdan

It is reload! in the class definition.

Please sign in to comment.
Something went wrong with that request. Please try again.