我有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"
}
}
}
}
}