Backbone create sends PUT /api/presets/undefined instead of POST /api/presets
I'm porting code written for Backbone 1.0.0 to a new app using Backbone 1.1.2 and I noticed that isNew() seems broken for objects using custom idAttributes.
We are using model.save(settings, {wait:true}) and the Model is configured with idAttribute: "name" :
Backbone 1.1.2 wrongfully sends the request to PUT /api/presets/undefined.
Before it was going to POST /api/presets/.
Our device's presets map to filenames in a directory and they don't have ID the web interfaces uses the name as ID for this model.
In Backbone 1.0.0, the same code was causing isNew() to return true:
This is our save() call. I inspected that the model does not have name in it's attributes and is passed a new one via settings:
This could be the commit that broke this :
https://github.com/jashkenas/backbone/commit/11cc0e863f9951b4242144d65b581348bd9ee092
I tried to patch this commit but it does not resolves it:
https://github.com/jashkenas/backbone/commit/9f81d980f0599e8691af80034944d4abafb3f44b
So I continue investigating why isNew() walks on an object that has "name" set in the model and it is because of this line and that wait is true :





Recent Comments