The store tracks changes in relationships with special objects. You can ask the store for a change object for this relationship:
store.relationshipChangeFor(child.get('clientId'), belongsToAssociationName);
If no changes were made, it will not return anything.
But you will probably never need this. In the case of a relational data warehouse, a child record will be responsible for maintaining its associations. If you successfully create / update, you can blindly mark all these relations as allowed, and the store does not care if some of them were not actually dirty.
In fact, exactly what DS.RESTAdapter now:
DS.RESTAdapter = DS.Adapter.extend({
Whenever you decide that you are ready to mark the relationship as resolved, simply call store.didUpdateRelationship(child, belongsToAssociationName) .
All that is said, the real trick is not to define the relationship as allowed (since it has already been implemented) - it is to postpone the saving of the child until the parent is created.
We actually sent a transfer request that does just that. If this helps you to the extent that it helps us, we will be grateful for the support upon request.
source share