Ember资料求助!无法将 JSON 反序列化为模型

Ember data help! Unable to de-serialise JSON to model

我正在使用:

Ember 1.10.0 Ember 数据 1.0.0-beta.15

我有这样一个模型:

//models//acceptedtask.js
import DS from "ember-data";
export default DS.Model.extend({
    userAggregateId: DS.attr('number'),
    taskAggregateId: DS.attr('number'),
    name: DS.attr('string')
});

我从服务器取回:

{"acceptedTask":{"id":5,"userAggregateId":1,"taskAggregateId":3,"name":"Clean table"}}

每当我得到这个 json 回来时 ember 就会抛出以下错误:

Error: Assertion Failed: You must include an `id` for task-management@model:acceptedtask: in an object passed to `push`
    at new Error (native)
    at Error.EmberError (http://localhost:4200/assets/vendor.js:22992:23)
    at Object.Ember.assert (http://localhost:4200/assets/vendor.js:14489:15)
    at Ember.Object.extend.push (http://localhost:4200/assets/vendor.js:74317:15)
    at http://localhost:4200/assets/vendor.js:74783:24
    at Object.Backburner.run (http://localhost:4200/assets/vendor.js:10749:27)
    at ember$data$lib$system$store$$_adapterRun (http://localhost:4200/assets/vendor.js:74759:32)
    at http://localhost:4200/assets/vendor.js:74780:16
    at tryCatch (http://localhost:4200/assets/vendor.js:60990:16)
    at invokeCallback (http://localhost:4200/assets/vendor.js:61002:17)

有人能帮我解决这个问题吗?在搜索了一半互联网以解决类似问题后,我觉得我缺少一些基本的东西:(

谢谢,

汤姆

我使用了您的模型和响应。但是,为了让它正确填充,我必须更改

的响应
{"acceptedTask":{"id":5,"userAggregateId":1,"taskAggregateId":3,"name":"Clean table"}}

{"acceptedtask":{"id":5,"userAggregateId":1,"taskAggregateId":3,"name":"Clean table"}}

除此之外,它看起来不错。但是,我收到了以下警告,而不是您指出的错误:

"WARNING: Encountered "acceptedTask" in payload, but no model was found for model name "acceptedTask"