Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4836

Ember data: Revert belongsTo destroy

$
0
0

@leondmello wrote:

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?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4836

Trending Articles