I'm trying to destroy a model (both in a collection and on my server), and from what I understand, backbone.js should pass the model.id and a DELETE request to my server if I call
this.model.destroy();
when I view console.log(this.model);, the console shows my model with this structure.
d _callbacks: Object _changed: false _changing: false _escapedAttributes: Object _previousAttributes: Object attributes: Object cid: "c2" collection: d id: 13 __proto__: o
rails returns a 404 error, and when I output the response from backbone destroy function, I get
Object
abort: function (a){a=a||"abort",p&&p.abort(a),w(0,a);return this}
always: function (){return b.done.apply(b,arguments).fail.apply(this,arguments)}
complete: function (){if(!d){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g↵↵↵ ↵ Action Controller: Exception caught↵ ↵ body { background-color: #fff; color: #333; }↵↵ body, p, ol, ul, td {↵ font-family: helvetica, verdana, arial, sans-serif;↵ font-size: 13px;↵ line-height: 18px;↵ }↵↵ pre {↵ background-color: #eee;↵ padding: 10px;↵ font-size: 11px;↵ }↵↵ a { color: #000; }↵ a:visited { color: #666; }↵ a:hover { color: #fff; background-color:#000; }↵ ↵↵↵↵Routing Error
↵No route matches [DELETE] "/menu_dishes"
↵↵↵↵↵↵"
setRequestHeader: function (a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this}
status: 404
statusCode: function (a){if(a){var b;if(s
Any idea on how I should be deleting my model? I don't see anything in the documentation about how I can pass the model id through to rails, as I think that is what is missing.
Backbone.emulateHTTP = true;. Maybe worth a try. - mna