2013-10-02 71 views

回答

2

下已經工作了我因爲ED 1.0測試2:

var child = this.get('store').createRecord('child', { 
    name: 'New Child', 
    parent: parent 
}; 
child.save(); 

parent.get('children').addObject(child); 
// My backend automatically adds the inverse of relationships when saving  
// the child, so I don't need to save the parent separately 

其中parent是父對象。您可能需要在控制器中指定needs: ['parent'],然後使用var parent = this.get('controllers.parent.content');獲取父級,其中「parent」是父級對象的名稱。

相關問題