My setup:
- ember-cli : 0.1.2
- Ember : 1.8.1
- Ember Data : 1.0.0-beta.11
- Handlebars : 1.3.0
- jQuery : 1.11.1
- active-model-serializers: 0.8.0 (server-side)
I’m running into issues retrieving data from my API. When following the JSON conventions laid out in the guides Ember Data doesn’t seem to be able to extract the data for each type. However, when using the master/0.10 branch of active-model-serializers I am able to load the data but the data returned doesn’t follow the conventions.
AMS Response Examples
- 0.8 / Rejected
{"question":{"id":1,"prompt":"Please select the gender","questionType":"select","possibleAnswers":[2,3,4]}}
- 0.10 / Accepted
{"id":1,"prompt":"Please select the gender","questionType":"select","possibleAnswers":[2,3,4]}
The 0.8 version results in the following error message:
Error while processing route: questions.edit Assertion Failed: You must include an
id
for reagents@model:question: in an object passed topush
Error: Assertion Failed: You must include anid
for reagents@model:question: in an object passed topush
The method Ember-Data references.
Model for reference:
define("reagents/models/question",
["ember-data","exports"],
function(__dependency1__, __exports__) {
"use strict";
var DS = __dependency1__["default"];
var Question;
Question = DS.Model.extend({
prompt: DS.attr('string'),
questionType: DS.attr('string'),
questionParts: DS.hasMany('question-part', {
async: 'true'
}),
possibleAnswers: DS.hasMany('answer', {
async: 'true'
}),
rootLevel: DS.attr('boolean', {
defaultValue: 'true'
})
});
__exports__["default"] = Question;
});//# sourceURL=reagents/models/question.js
Any guidance on where to look would be appreciated!