Reputation: 997
Sometimes in my Ember app I create some records with createRecord, but I don't want to store all of them on the server. So I call destroy
on the objects I don't need before calling store.commit()
. Yet, they are sent to the server nonetheless. How do you prevent this?
I have tried to commit
in the "next" Ember run but it does not work either:
... do some clean up ...
Ember.run.next(self, function() {
self.store.commit(); // The destroyed objects are committed nonetheless
});
Thanks!
PJ
Upvotes: 2
Views: 171
Reputation: 10552
deleteRecord
is the appropriate method to call on DS.Model
instances. A complex state is managed by DS.Store
, and as such it coordinates deletions separately from the low-level destroy
method.
Upvotes: 3