I have a very basic backbone (sample) application which just creates and destroys model items. When the model is created the object is persisted with a POST to the web server, but when the model is destroyed there is no DELETE sent to the server? Any idea why this might be?
very basic model:
window.User = Backbone.Model.extend({
urlRoot: 'users'
});
my test code just to create and delete the model:
var model = null;
$(".add").click(function(){
if (model == null) {
model = new window.User;
model.set({name: 'meeee'});
model.save();
}
});
$(".remove").click(function(){
if (model != null) {
model.destroy();
}
});
The JSON response when creating the model seems good too:

Backbone doesn’t know that _id is the name you are using for your id field, unless you’ve modified your copy of Backbone.js somehow (please don’t). To tell Backbone what the name of your id field is for some particular model, idAttribute in your Model definition. Otherwise, it defaults to the regular
id.Without the “identity” field set, Backbone is going to consider that the the model instance “isNew” (a model instance which hasn’t been persisted to the server), so when there’s no “identity” (as in your case, as it doesn’t know that your identity is, instead,
_id) there wouldn’t be any need to destroy it on the server.