Resolved: Did Ember-data beta.11 change for expected JSON responses

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 to push Error: Assertion Failed: You must include an id for reagents@model:question: in an object passed to push

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!

I determined that this was all my fault. :cry:

I originally mocked out requests through ember-cli’s http-mock and forgot to remove the default serializer that was in place.