rails/rails — pull request #10816 by bogdan (2013-06-01 10:41:50+00:00)
Title: Make AM::Dirty less dirty to plugin into AR or other library

Added new API methods #reset_changes! and #changed_applied!
to control changes state. Previsously you needed to update internal
instance variables, but now API methods is available.

``` ruby
class Person
include ActiveModel::Dirty

define_attribute_methods :name

# Old way:

def save
# do some work
@previously_changed = changes
@changed_attributes = nil
end

def reload
# do some work
@previously_changed = nil
@changed_attributes = nil
end

# New way:

def save
# do some work
changes_applied!
end

def reload
# do some work
reset_changes!
end
end