lib/neo4j/shared/initialize.rb in neo4j-9.5.3 vs lib/neo4j/shared/initialize.rb in neo4j-9.6.0

- old
+ new

@@ -25,22 +25,32 @@ end end # We should be using #clear_changes_information # but right now we don't use `ActiveModel` attributes correctly and so it doesn't work + # Once we set @attribute correctly from using class ActiveModel::Attribute + # we will no longer need to explicitly call following method and can safely remove it def changed_attributes_clear! return if changed_attributes.nil? + # with ActiveModel 6.0.0 we have to clear attribute changes with clear_attribute_changes + clear_attribute_changes(self.attributes.keys) + # changed_attributes is frozen starting with ActiveModel 5.2.0 # Not a good long term solution if changed_attributes.frozen? @attributes_changed_by_setter = ActiveSupport::HashWithIndifferentAccess.new else changed_attributes && changed_attributes.clear end end + # Once we set @attribute correctly from using class ActiveModel::Attribute + # we will no longer need to explicitly call following method and can safely remove it def changed_attributes_selective_clear!(hash_to_clear) + # with ActiveModel 6.0.0 we have to clear attribute changes with clear_attribute_change + hash_to_clear.each_key { |k| clear_attribute_change(k) } if defined?(ActiveModel::ForcedMutationTracker) + # changed_attributes is frozen starting with ActiveModel 5.2.0 # Not a good long term solution if changed_attributes.frozen? attributes_changed_by_setter = ActiveSupport::HashWithIndifferentAccess.new(changed_attributes) hash_to_clear.each_key { |k| attributes_changed_by_setter.delete(k) }