原來,我在我的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