Suppose I have two models, parent
and child
which share a belongsTo
relationship.
models/parent.js
{
child: belongsTo('')
}
models/child.js
{
parent: belongsTo('')
}
In one of my controllers, I want to destroy the two records, so I have code which does something like,
model.get('child').destroyRecord()
.then(() => {
model.destroyRecord();
});
How do I revert the delete on the child if the parent’s model.destroyRecord()
fails?
What is the preferred approach to revert dependent relationship deletes?