New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RESTAdapter] Allow new parent, child to be saved at once #437
Comments
👍 I think there is a more general concept behind this. I would love @wycats, @tomdale or @tchak around this. imagine you modify a parent attribute + add a child. So two requests are send to the server: one for the parent, one for the child. But the server process the parent and answer with no child, then the child (so server-side, the parent has now one child). As a result, after the didSaveRecord, client-side, the parent does not have a child :/ I hope I've been clear... |
Because the notion of dependencies while saving is a fully adapter-level concern, we removed it from the store. Unfortunately, we have not yet had time to add the functionality back into Our long-term plan is to add similar In the meantime, you are welcome to implement this in your adapter manually. You may want to look at our old implementation for inspiration. Basically, you would look through each changed record with a changed |
+1 Just came across this issue now. This feature would be very helpful to have. |
We've added an implementation to our pull request, #440. |
+1 Having the same issue here. Would really like this issue to be fixed. |
+1 Having the same issue. |
+1 Same. I assume you're working on a fix for this from the embedded-records branch? Any idea when this will be merged into master? Thanks! |
👍 Good work on both ember and ember data. Making this issue work will make it even better :) |
Any update on this? ### Asynchronous Commits Typically, all of the records in a transaction will be committed Should this be a bug, with a 1.0 milestone? |
closing in favour of: #724 |
When the relationship branch was merged, it removed the concept of one model "waiting on" another model (via a "pending" state). This means it is no longer possible to commit a new parent and child at the same time, like so:
At this point, there will be two people in the database, and (since we're assuming a relational database) we'd expect that the child would have a
parent_id
equal toparent.id
. However, the child'sparent_id
is actually saved asNULL
.The actual commit of the new child record by the REST adapter needs to wait for the parent's commit to finish so that it can obtain and use the parent's ID.
The text was updated successfully, but these errors were encountered: