How to implement REST transaction handling with ember data?


#1

I tried to figure out how to implement transactions. All resources I found aren’t really good. Has someone any good resources of how to realise REST transactions?

If someone implemented transactions combined with ember data then please let us talk.


#2
invoice.save().then(function(invoice){
            self.set('content.invoiceId', parseInt(invoice.id, 10));
            invoice.get('lineItems').then(function(lineItems){
                self.get('content').save().then(self.didSave.bind(self), self.paymentDidNotSave.bind(self));
            });
        }, function(error) {      
            lineItem.deleteRecord();
            invoice.deleteRecord();
        });

wrap the deleteRecord’s in the error handling callbacks of promises and if anything fails make to sure delete everything else