vendredi 26 juin 2015

Error with get('model').addObjects() in Ember 1.13.0

I'm upgrading an Ember application from 1.11 to 1.13.2

I've got a blog initially displaying 5 blog-entries. They are loaded in the model with this route:

import Ember from 'ember';
export default Ember.Route.extend({

  model: function() {
    return this.store.find('post', {limit: 5});
   }
});

There's a button to load more entries in the controller:

loadMore: function() {
  var self = this
  this.store.find('post', {limit: 5,
                           skip: 5})
    .then(function(posts) {
      self.incrementProperty('page');
      self.get('model').addObjects(posts);
    });
}

However since upgrading I get this error after loadMore was executed:

TypeError: internalModel.getRecord is not a function
    at Ember.ArrayProxy.extend.objectAtContent (record-array.js:84)
    at _emberRuntimeSystemObject.default.extend.objectAt (ember.debug.js:35919)
    at _emberRuntimeSystemObject.default.extend.objectAtContent (ember.debug.js:35780)
    at _emberRuntimeSystemObject.default.extend.objectAt (ember.debug.js:35919)




Aucun commentaire:

Enregistrer un commentaire