We fixed this by modifying the Collection#create function to return the result of calling model.save (line 840) which is a jQuery Promise. We may or may not have .pipe'd it, I'd have to check.
Next, we leveraged the Promise API to handle success and error callbacks, specifically:
collection.create(bleh)
.done(function (model) { var xhr = this; })
.fail(function (resp) { var xhr = this; });
This is far cleaner that screwing around with success/error callbacks which don't work well when you're trying to mock the backend. If you want to get fancy (we did), you can build a default fail function and always pass that.
Next, we leveraged the Promise API to handle success and error callbacks, specifically:
This is far cleaner that screwing around with success/error callbacks which don't work well when you're trying to mock the backend. If you want to get fancy (we did), you can build a default fail function and always pass that.