diff options
author | Tore Darell <toredarell@gmail.com> | 2010-08-02 21:15:44 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-08-03 10:47:30 +0200 |
commit | 2c8a4a53a8c38a43a62342b9d46014242e781d18 (patch) | |
tree | d08de979536d3b94656658b605737602e90e6fae /activemodel/lib/active_model/dirty.rb | |
parent | fb2b8fec245a96da015c5c6223ad264fa47d90bd (diff) | |
download | rails-2c8a4a53a8c38a43a62342b9d46014242e781d18.tar.gz rails-2c8a4a53a8c38a43a62342b9d46014242e781d18.tar.bz2 rails-2c8a4a53a8c38a43a62342b9d46014242e781d18.zip |
Remove or fix non-working examples and add a few tests to Dirty [#5185 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activemodel/lib/active_model/dirty.rb')
-rw-r--r-- | activemodel/lib/active_model/dirty.rb | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/activemodel/lib/active_model/dirty.rb b/activemodel/lib/active_model/dirty.rb index 5ea7636427..2516377afd 100644 --- a/activemodel/lib/active_model/dirty.rb +++ b/activemodel/lib/active_model/dirty.rb @@ -37,12 +37,13 @@ module ActiveModel # end # # def name=(val) - # name_will_change! + # name_will_change! unless val == @name # @name = val # end # # def save # @previously_changed = changes + # @changed_attributes.clear # end # # end @@ -77,12 +78,6 @@ module ActiveModel # person.changed # => ['name'] # person.changes # => { 'name' => ['Bill', 'Bob'] } # - # Resetting an attribute returns it to its original state: - # person.reset_name! # => 'Bill' - # person.changed? # => false - # person.name_changed? # => false - # person.name # => 'Bill' - # # If an attribute is modified in-place then make use of <tt>[attribute_name]_will_change!</tt> # to mark that the attribute is changing. Otherwise ActiveModel can't track changes to # in-place attributes. |