lib/neo4j/shared/persistence.rb in neo4j-5.0.2 vs lib/neo4j/shared/persistence.rb in neo4j-5.0.3
- old
+ new
@@ -76,11 +76,27 @@
_persisted_obj && _persisted_obj.exist?
end
# Returns +true+ if the object was destroyed.
def destroyed?
- @_deleted || (!new_record? && !exist?)
+ @_deleted || _destroyed_double_check?
end
+
+ # These two methods should be removed in 6.0.0
+ def _destroyed_double_check?
+ if _active_record_destroyed_behavior?
+ true
+ else
+ (!new_record? && !exist?)
+ end
+ end
+
+ def _active_record_destroyed_behavior?
+ fail 'Remove this workaround in 6.0.0' if Neo4j::VERSION >= '6.0.0'
+
+ !!Neo4j::Config[:_active_record_destroyed_behavior]
+ end
+ # End of two methods which should be removed in 6.0.0
# @return [Hash] all defined and none nil properties
def props
attributes.reject { |_, v| v.nil? }.symbolize_keys