From 7ab96ca64a0cfe18cc83eaf83f80fa28ba5408f7 Mon Sep 17 00:00:00 2001 From: Chris Grigg Date: Fri, 30 Jan 2015 10:41:09 -0500 Subject: [PATCH] fix id property inheritance prior to session --- lib/neo4j/active_node.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/neo4j/active_node.rb b/lib/neo4j/active_node.rb index b0e6e1c75..504e637a0 100644 --- a/lib/neo4j/active_node.rb +++ b/lib/neo4j/active_node.rb @@ -46,7 +46,7 @@ def neo4j_obj included do def self.inherited(other) - inherit_id_property(other) if self.id_property? + inherit_id_property(other) inherited_indexes(other) if self.respond_to?(:indexed_properties) attributes.each_pair { |k, v| other.attributes[k] = v } inherit_serialized_properties(other) if self.respond_to?(:serialized_properties) @@ -64,9 +64,12 @@ def self.inherit_serialized_properties(other) end def self.inherit_id_property(other) - id_prop = self.id_property_info - conf = id_prop[:type].empty? ? {auto: :uuid} : id_prop[:type] - other.id_property id_prop[:name], conf + Neo4j::Session.on_session_available do |_| + return unless self.id_property? + id_prop = self.id_property_info + conf = id_prop[:type].empty? ? {auto: :uuid} : id_prop[:type] + other.id_property id_prop[:name], conf + end end Neo4j::Session.on_session_available do |_|