lib/neo4j/shared/persistence.rb in neo4j-9.5.3 vs lib/neo4j/shared/persistence.rb in neo4j-9.6.0
- old
+ new
@@ -240,10 +240,17 @@
.set("#{element_name}.`#{attribute}` = COALESCE(#{element_name}.`#{attribute}`, 0) + {by}")
.params(by: by).limit(1)
.pluck("#{element_name}.`#{attribute}`").first
return false unless new_attribute
self[attribute] = new_attribute
- set_attribute_was(attribute, new_attribute)
+
+ if defined? ActiveModel::ForcedMutationTracker
+ # with ActiveModel 6.0.0 set_attribute_was is removed
+ # so we mark attribute's previous value using attr_will_change method
+ clear_attribute_change(attribute)
+ else
+ set_attribute_was(attribute, new_attribute)
+ end
true
end
private