提交 d0e1c692 编写于 作者: J José Valim

Merge pull request #6024 from carlosantoniodasilva/amo-dirty-refactor

Improve AMo::Dirty *_will_change! method
......@@ -151,13 +151,15 @@ def attribute_was(attr)
# Handle <tt>*_will_change!</tt> for +method_missing+.
def attribute_will_change!(attr)
return if attribute_changed?(attr)
begin
value = __send__(attr)
value = value.duplicable? ? value.clone : value
rescue TypeError, NoMethodError
end
changed_attributes[attr] = value unless changed_attributes.include?(attr)
changed_attributes[attr] = value
end
# Handle <tt>reset_*!</tt> for +method_missing+.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册