调用deleteRecord后我收到此错误,然后保存在实体上。我使用DS.RESTAdapter并且删除在后端工作得非常好,但是控制台却抛出了这个错误
Error: No model was found for 'id'
at new Error (native)
at Error.Ember.Error (http://localhost:3000/assets/ember.js?body=1:913:19)
at Ember.Object.extend.modelFor (http://localhost:3000/assets/ember-data.js?body=1:9808:33)
at JSONSerializer.extend.extractSingle (http://localhost:3000/assets/ember-data.js?body=1:3021:28)
at superWrapper [as extractSingle] (http://localhost:3000/assets/ember.js?body=1:1295:16)
at Ember.Object.extend.extractSave (http://localhost:3000/assets/ember-data.js?body=1:2511:21)
at Ember.Object.extend.extractDeleteRecord (http://localhost:3000/assets/ember-data.js?body=1:2468:21)
at Ember.Object.extend.extract (http://localhost:3000/assets/ember-data.js?body=1:2368:37)
at http://localhost:3000/assets/ember-data.js?body=1:10436:32
at invokeCallback (http://localhost:3000/assets/ember.js?body=1:10016:19) ember.js?body=1:3524
未捕获错误:断言失败:错误:未找到' id'
App.UserRoute = Ember.Route.extend({
actions: {
deletetag: function(params) {
this.get('store').find('usertag', params.id).then(function(rec){
rec.deleteRecord();
rec.save();
});
}
}
});
为什么ember试图返回名为" id"的模型的工厂实例? ?
谢谢!
答案 0 :(得分:1)
愚蠢的错误。错误是从destroy方法返回的json缺少对象root。