You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
book.page_ids can return an array of unique ids of related pages instances book.page_ids = [....]; book.save is supposed to update its relation, as it does in v9.x.
But in v10.0, this doesn't work, since it will issue delete queries that delete existing relation only AFTER issuing create queries.
This causes trouble if some id in the array is included in the existing relations.
In an extreme case, if you pass the exact same id array, then this will completely destroy existing relations.
This can be solved by just reversing the order of relational queries.
Additional information which could be helpful if relevant to your issue:
@shu-bc it would be always helpful to have a complete spec. Are you saying that this spec will fail?
it 'does not delete pages on reassignment` do
page = Page.create
book = Book.create(pages: page)
book.page_ids = [page.id]
book.save
expect(book.pages).to be_present
end
Suppose a book model
has_many
pages like thisbook.page_ids
can return an array of unique ids of related pages instancesbook.page_ids = [....]; book.save
is supposed to update its relation, as it does in v9.x.But in v10.0, this doesn't work, since it will issue delete queries that delete existing relation only AFTER issuing create queries.
This causes trouble if some id in the array is included in the existing relations.
In an extreme case, if you pass the exact same id array, then this will completely destroy existing relations.
This can be solved by just reversing the order of relational queries.
Additional information which could be helpful if relevant to your issue:
Code example (inline, gist, or repo)
Runtime information:
Neo4j database version: neo4j 3.4.0
neo4j
gem version: v10.0neo4j-core
gem version:The text was updated successfully, but these errors were encountered: