我試圖用Ember和Node創建一個記錄。顯然,Ember喜歡嵌套你的物體。Ember createRecord/RESTAdapater沒有嵌套
如果我給它:
this.store.createRecord('meal', {
name: 'the name',
meal_time: 'the time',
tolerance: 'ouch'
}).save();
節點獲得這req.body
:
{ meal:
{ id: 'e5c90c23-1eb1-49e1-a3fa-865944b5eeea',
name: 'the name',
meal_time: 'the time',
tolerance: 'ouch' }
}
我寧願修改餘燼側比節點側。
有沒有辦法讓createRecord
發送對象而不嵌套它?
多數民衆贊成在多餘的作品!它試圖考慮使用REST資源來保存模型。另外從REST Api的角度來看,這是正確的。 – AnujKu