lib/architect4r/model/node.rb in architect4r-0.3.3.1 vs lib/architect4r/model/node.rb in architect4r-0.3.4

- old
+ new

@@ -23,22 +23,21 @@ subklass.class_exec do def self.model_root @model_root ||= begin # Check if there is already a model root, - query = "start root = node(0) match (root)-[r:#{ model_root_relation_type}]->(x) where r.architect4r_type and r.architect4r_type = '#{name}' return x" - the_root = connection.execute_cypher(query).to_a.first + query = "start root = node(0) match root-[r:#{model_root_relation_type}]->x where r.architect4r_type and r.architect4r_type = '#{name}' return x" + the_root = connection.cypher_query(query).to_a.first the_root &&= the_root['x'] # otherwise create one the_root ||= begin - m_root = connection.create_node(:name => "#{name} Root") + m_root = connection.create_node(:name => "#{name} Root", :root_for => name) connection.create_relationship(0, m_root, model_root_relation_type, { 'architect4r_type' => name }) - m_root + + # Return model root node + GenericNode.send(:build_from_database, m_root) end - - # Return model root node - GenericNode.send(:build_from_database, the_root) end end end end \ No newline at end of file