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

user.posts = [same posts as earlier], should not delete all existing posts relations and create similar new ones. #1531

Closed amitsuryavanshi closed 4 years ago

amitsuryavanshi commented 5 years ago

post1, post2, post3 are all Posts related to a user tom, tom.posts.to_a returns me array of posts [post1, post2, post3]. Now if I do tom.posts = [post1, post2, post3], it deletes all existing relationships between tom and 'post1, post2, post3' and creates same new relations for tom with same posts post1, post2, post3.

Expected behaviour would be to not delete existing relations and create same ones. We should delete or create only delta.

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

Code example (inline, gist, or repo)

Runtime information:

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

amitsuryavanshi commented 4 years ago

Addressed with https://github.com/neo4jrb/neo4j/pull/1584.