title: Error while trying to load ember data model from REST API
body: <p>Version: Ember 2.11</p>
  
  <p>I am trying to use Ember data model to load the data from REST API but it is failing with error message as 
  "<strong>ember.debug.js:17634 TypeError: Cannot read property 'type' of undefined
      at Class._pushInternalModel (store.js:2005)</strong></p>
  
  <p>Here is more details:
  1. REST API response is:</p>
  
  <pre><code>     {  
        "sfresults":[  
                {  
                 "url":"https://google.com/1",
                 "title":"Titl1",
                 "description":"Description1",
                "type":"KB",
                "lastModifiedDate":"12/23/16",
                "viewScore":"86.12006476690622",
                "caseNumber":"case1",
                "id":"cd4ac3e8-c3ac-4be5-ad11-c62a85ddf289"
               },
              {  
                 "url":"https://google.com/2",
                 "title":"Titl2",
                 "description":"Description2",
                 "type":"KB",
                 "lastModifiedDate":"12/23/16",
                  "viewScore":"86.12006476690622",
                 "caseNumber":"case2",
                "id":"cd4ac3e8-c3ac-4be5-ad11-c62a85ddf289"
             },
          ],
      "message":"SUCCESS",
     "id":"3bd116c7-db63-4277-8ace-a7ea846a04ee"
    }
  </code></pre>
  
  <p><strong>Controller code:</strong></p>
  
  <pre><code>          let sfdata = this.store.query('sfresult',{ 'searchText': inputSearchText, 'searchType' : 'SF' } );
             this.set('sfresult', sfdata);
  </code></pre>
  
  <p><strong>My Models</strong></p>
  
  <pre><code> sfresult.js
  
        import DS from 'ember-data';
        export default  DS.Model.extend({
        sfresults: DS.hasMany('sfresults'),
        message: DS.attr('string')
       });
  
  sfresults.js
         import DS from 'ember-data';
  
         export default  DS.Model.extend({
  
         title: DS.attr('string'),
         description: DS.attr('string'),
         caseNumber: DS.attr('string'),
         lastModifiedDate: DS.attr('string'),
         type: DS.attr('string'),
         url: DS.attr('string'),
         searchText: DS.attr('string'),
         messageId: DS.attr('string')
       });
  
       export default DS.RESTAdapter.extend({
       host: 'http://localhost:8080',
      namespace: 'server'
     });
  </code></pre>
  
  <p>Then i wanted to iterate sfresult and show it in the UI. but here as soon as API call response comes back it is unable to load into ember data models. fails with above error. </p>
  
  <p>Note: if i try without hasMany model it works fine - meaning json response having array of elements and using only sfresults model without sfresult, but wanted to get the message in the JSON response to act accordingly - please ignore this statement if it is confusing a bit.</p>
  
  <p>Any help would be greatly appreciated. </p>