0
我有一个account
模型,有以下几点:多重关系
export default Model.extend({
primaryStaff: belongsTo('staff'),
secondaryStaff: belongsTo('staff')
});
primaryStaff
映射到primaryStaffId
关键的account
模型和secondaryStaff
映射到secondaryStaffId
。有没有办法让这些都指向staff
模型?
没有任何运气。谢谢!
更新:
我使用JSON API适配器 - 这里有一个样品的有效载荷:
{
"data": {
"type": "account",
"id": "17",
"attributes": {
"businessId": 1,
"userId": 22,
"scopes": [
"customer",
"customer-22"
],
"keyCode": null,
"lockboxCode": null,
"notes": null,
"active": false,
"createdAt": "2017-01-31T20:13:39.465Z",
"updatedAt": "2017-02-20T03:49:17.308Z",
},
"relationships": {
"business": {
"data": {
"type": "business",
"id": "1"
}
},
"customer": {
"data": {
"type": "customer",
"id": "22"
}
},
"secondaryStaff": {
"data": null
},
"primaryStaff": {
"data": {
"type": "staff",
"id": "1"
}
}
}
}
}
'keyForRelationship'正是我所错过的。非常感谢你! – jdixon04
使用JSON API适配器时,我实际上似乎无法使其工作。查看上面更新的帖子。谢谢! – jdixon04
嗨 - 我以为我有一个通知,你已经做了一些改变,但似乎不再存在。你删除它了吗? – jdixon04