I am trying to set a model's attribute to be something different. When I save the model, Backbone issues a POST request instead of a PUT request.
I read on another Stackoverflow post that Backbone uses a model's id to determine if a model is new or not. When I console.log(model)
, the model has an id attribute. When I console.log(model.id)
, it prints out undefined. How come when I do a console.log(model)
, the model has a id attribute, yet when I do console.log(model.id)
, I get back undefined?
Which way does Backbone use to determine if a model is new or not? And, how can I fix the problem? I am using backbone-tastypie.