2

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

PJC
  • 997
  • 7
  • 21

1 Answers1

3

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.

Christopher Swasey
  • 10,392
  • 1
  • 31
  • 25
  • Thanks a lot Christopher. For some reason I thought deleteRecord was going to issue a DELETE command to the server. So I did not want to use it. But you are right it does work and it does not send a DELETE. Thanks! – PJC Mar 23 '13 at 10:12