mardi 28 mars 2017

findAll throwing error

I am using a simple findAll query in my ember application ( ember-version: 2.12.0, ember-data-version: 2.12.1 ) and I get the following error:

Assertion Failed: You can no longer pass a modelClass as the first argument to store.buildInternalModel. Pass modelName instead.

I am using the RESTAdapter and RESTSerializer.

Here is my team model:

import DS from 'ember-data';

export default DS.Model.extend({
  name: DS.attr('string'),

  projects: DS.hasMany('project'),
  users: DS.hasMany('user'),
  members: Ember.computed('users', function() {
    return this.get('users.content.length');
  }),
  leader: DS.belongsTo('user', {
    inverse: 'team'
  })
});

and my team serializer:

import ApplicationSerializer from './application';
import DS from 'ember-data';

export default ApplicationSerializer.extend(DS.EmbeddedRecordsMixin,{
  attrs: {
    users: { async: true },
    projects: { async: true }
  }
});

Despite the error, the team objects I requested are in the store. I had no luck in solving this so far.




Aucun commentaire:

Enregistrer un commentaire