neo4jrb / activegraph

An active model wrapper for the Neo4j Graph Database for Ruby.
http://neo4jrb.io
MIT License
1.4k stars 276 forks source link

has_many/has_one association leaves orphan nodes #1551

Open lshimokawa opened 5 years ago

lshimokawa commented 5 years ago

Related to: https://github.com/neo4jrb/neo4j/issues/1548

Additional information which could be helpful if relevant to your issue:

Code example (inline, gist, or repo)

class Person
  include Neo4j::ActiveNode
  has_one :out, :parent, type: :parent, model_class: :Person
  has_many :in, :children, origin: :parent, model_class: :Person    
end

root = Person.create!(children: [p1=Person.create!, p2=Person.create!])
root.update(children: [p1])

image

image

Runtime information:

Neo4j database version: neo4j gem version: neo4j-core gem version: