lib/cassandra_object/dirty.rb in gotime-cassandra_object-2.6.1 vs lib/cassandra_object/dirty.rb in gotime-cassandra_object-2.6.2
- old
+ new
@@ -18,9 +18,17 @@
@previously_changed = changes
@changed_attributes.clear
end
end
+ # <tt>reload</tt> the record and clears changed attributes.
+ def reload
+ super.tap do
+ @previously_changed.try :clear
+ @changed_attributes.clear
+ end
+ end
+
def write_attribute(name, value)
name = name.to_s
unless attribute_changed?(name)
old = read_attribute(name)
changed_attributes[name] = old if old != value