I have extended the program given in this stackoverflow answer to have a program that deletes all the records all at once. However, the deletion happens only in batches and
Calling deleteRecord()
within forEach
will break the loop. You can fix it by wrapping the delete code in an Ember.run.once
function like this:
this.get('store').findAll('org').then(function(record){
record.content.forEach(function(rec) {
Ember.run.once(this, function() {
rec.deleteRecord();
rec.save();
});
}, this);
});
See this jsBin.