简体   繁体   中英

Why am I getting an error after successful deleteRecord in Ember

I get this error after calling deleteRecord and then save on an entity. I'm using the DS.RESTAdapter and delete works perfectly well in the backend but the console is throwing this error

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

Uncaught Error: Assertion Failed: Error: No model was found for 'id'

App.UserRoute = Ember.Route.extend({
    actions: {
        deletetag: function(params) {
            this.get('store').find('usertag', params.id).then(function(rec){
                rec.deleteRecord();
                rec.save();
            });
        }
    }

});

Why is ember trying to return a factory instance of a model called "id" ?

Thanks!

Dumb mistake. The error was the json returned from the destroy method was missing the object root.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM