如果我有以下多对多关系
// User
export default DS.Model.create({
name: DS.attr('string'),
authorities: DS.hasMany()
});
// Authority
export default DS.Model.create({
name: DS.attr('string'),
users: DS.hasMany()
});
我向用户添加权限
user.get('authorities').pushObject(authority);
从它所说的JSONAPI文档中使用POST请求来更新hasMany关系
POST /users/XXX/relationships/authorities
{
"data": [
{ "type": "authorities", "id": "YYY" },
]
}
如何通过ember-data生成此请求?