lib/neo4j/shared/persistence.rb in neo4j-9.2.1 vs lib/neo4j/shared/persistence.rb in neo4j-9.2.2
- old
+ new
@@ -12,11 +12,11 @@
def update_model
return if skip_update?
props = props_for_update
neo4j_query(query_as(:n).set(n: props))
_persisted_obj.props.merge!(props)
- changed_attributes.clear
+ changed_attributes_clear!
end
def skip_update?
changed_attributes.blank?
end
@@ -162,11 +162,11 @@
end
def reload
return self if new_record?
association_proxy_cache.clear if respond_to?(:association_proxy_cache)
- changed_attributes && changed_attributes.clear
+ changed_attributes_clear!
unless reload_from_database
@_deleted = true
freeze
end
self
@@ -200,11 +200,11 @@
self.class.run_transaction do
db_values = props_for_db(hash)
neo4j_query(query_as(:n).set(n: db_values))
db_values.each_pair { |k, v| self.public_send(:"#{k}=", v) }
_persisted_obj.props.merge!(db_values)
- db_values.each_key { |k| changed_attributes.delete(k) }
+ changed_attributes_selective_clear!(db_values)
true
end
end
alias update_columns update_db_properties
@@ -240,10 +240,10 @@
.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
- changed_attributes.delete(attribute)
+ set_attribute_was(attribute, new_attribute)
true
end
private