原来,我在我的Ember-Data模型中关于我的关系的声明是使用骆驼命名的,但必须使用dasherized声明。
例如:
// Example Investment model (investment.js)
export default DS.Model.extend({
// ...
/**
* The investment can have many transactions.
*/
investmentTransactions: DS.hasMany('investmentTransactions'),
// ...
});
...将工作在大多数情况下的罚款。然而,当试图侧向载荷(包括)我在查询数据:
store.findRecord('investment', someId, { include: 'investment-transactions' });
...将带回的投资有效载荷与所有投资交易沿着不过我灰烬的数据模型不能看到那些交易。为了解决这个问题,我hasMany
声明需要使用一个底线转换名称(这也适用于您的任何belongsTo
声明):
/**
* The investment can have many transactions.
*/
investmentTransactions: DS.hasMany('investment-transactions'),
来源
2016-09-16 14:48:14
Dan