0
모델에 첨부 된 컬렉션이 있습니다.하나의 속성 만 서버에 저장하도록 백본에게 알리는 편리한 방법이 있습니까?
: 나는 버튼을 클릭하면, 나는 서버
m.Survey = m.BaseModel.extend({
relations: [{
type: Backbone.HasMany,
key: 'invites',
relatedModel: 'APP.Models.SurveyInvite',
collectionType: 'APP.Collections.SurveyInvites',
//save invites separately
includeInJSON: false,
reverseRelation: {
key: 'survey',
//We don't want to list the survey when doing toJSON()
includeInJSON: false
}
}],
//need this method
saveInvites: function(){
this.saveOnly('invites');
});
});
그리고 나는 그것이 서버에 보낼에 해당 하나 개의 속성을 (컬렉션을 포함) 저장 백본을 말할 수 있도록하고 싶습니다 POST/API/조사/123/
{
invites: [
{<invite1>}, {<invite2>}, {<invitex>}
]
}
감사합니다! 나는 그것이 바로 그런 것이 었음을 알았고, 올바른 동사를 알지 못했다.) –