aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-12-01 11:00:53 -0800
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-12-01 11:00:53 -0800
commit42efdbf23e14fec629e32c6339ec4e8c85ae1701 (patch)
tree33b0511025d8a290c5d0a9298a37891eb2dde1d7 /activemodel/lib
parent90e2d96079ef262ba015c2ff86a25c332a1cc497 (diff)
parentcf7ab6056adfd1d2feb98444d82f89adcb6e5533 (diff)
downloadrails-42efdbf23e14fec629e32c6339ec4e8c85ae1701.tar.gz
rails-42efdbf23e14fec629e32c6339ec4e8c85ae1701.tar.bz2
rails-42efdbf23e14fec629e32c6339ec4e8c85ae1701.zip
Merge pull request #8391 from rmascarenhas/reset-attribute-doesnt-change-it
Reset attributes should not report changes.
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/dirty.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/dirty.rb b/activemodel/lib/active_model/dirty.rb
index d47c3ae1bb..ecb7a9e9b1 100644
--- a/activemodel/lib/active_model/dirty.rb
+++ b/activemodel/lib/active_model/dirty.rb
@@ -174,7 +174,10 @@ module ActiveModel
# Handle <tt>reset_*!</tt> for +method_missing+.
def reset_attribute!(attr)
- __send__("#{attr}=", changed_attributes[attr]) if attribute_changed?(attr)
+ if attribute_changed?(attr)
+ __send__("#{attr}=", changed_attributes[attr])
+ changed_attributes.delete(attr)
+ end
end
end
end