lib/mongomodel/concerns/attribute_methods/dirty.rb in mongomodel-0.2.3 vs lib/mongomodel/concerns/attribute_methods/dirty.rb in mongomodel-0.2.4

- old
+ new

@@ -11,25 +11,13 @@ # Returns the attributes as they were before any changes were made to the document. def original_attributes attributes.merge(changed_attributes) end - - # Wrap write_attribute to remember original attribute value. - def write_attribute(attr, value) - attr = attr.to_s - - # The attribute already has an unsaved change. - if changed_attributes.include?(attr) - old = changed_attributes[attr] - changed_attributes.delete(attr) if value == old - else - old = clone_attribute_value(attr) - changed_attributes[attr] = old unless value == old - end - - # Carry on. - super + + protected + def changed_attributes + attributes.changed end end end end