Backbone model.save() is causing POST not PUT
backbone.js
Solution
Try checking `user.isNew()`.
Looks like you created a new model which does not have an ID, that's why it's trying to add it during `Backbone.sync`.
UPDATE:
Above is exactly true. It does `POST` because it's a new model (which means, it does not have an id). Before you fetch a model, you need to give it an id. In your example:
var user = new User();
user.fetch();
user.save(); // in XHR console you see POST
var user = new User({ id: 123 });
user.fetch();
user.save(); // in XHR console you see PUT
Problem
I have a Backbone model: ``` var User = Backbone.Model.extend({ idAttribute: '_id', url: '/api/user', defaults: { username: '' } }); ``` I fetch it: ``` var user = new User(); user.fetch(); ``` Now, as an `click` event in one of my views, I have this: ``` toggleSubscription: function () { user.set('subscriptions', true); user.save(); } ``` This causes a POST request. However, the record already exists on the server, and since I fetched it (and the model instance has an `id` property), I thought that Backbone should do a PUT instead of a POST. Why might it be doing a POST instead?