我有一个这样的模型:
define([
'jquery',
'backbone'
], function ($) {
var MyModel = Backbone.Model.extend({
url: 'articles/',
initialize: function(){
}
});
return MyModel;
});
这是保存对象的代码:
article = new Article();
status = t.currentTarget.textContent;
article.set('ready', {'status': status});
coords = this.model.get('location').coords;
article.set('geo', {'lat': coords.latitude, 'lng': coords.longitude});
article.save(null, { accessToken: true }).done(function(){
self.hideIcons();
});
但是当我做补丁时:
this.article.save({comment: comment}, {patch: true, accessToken: true});
请求是正确的PATCH,但是端点错误,请求是这样的:
PATCH mydomain.com/articles/
如您所见,应该是:
PATCH mydomain.com/articles/<last-model-id-created>/
谢谢。