私はこのようなモデルを持っています:
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();
});
しかし、PATCH を実行すると、次のようになります。
this.article.save({comment: comment}, {patch: true, accessToken: true});
リクエストは正しく PATCH ですが、エンドポイントが間違っています。リクエストは次のようになります。
PATCH mydomain.com/articles/
ご覧のとおり、次のようになります。
PATCH mydomain.com/articles/<last-model-id-created>/
ありがとう。