lundi 20 juin 2016

Getting error: You need to pass a model name to the store's modelFor method

Using Ember 2.6.0

Have the following routes defined:

Router.map(function() {
  this.route('brands');
  this.route('brand', {path: '/brands/:brand_id'});
});

The model for brand is:

export default Model.extend({
  name: attr('string'),
  description: attr('string'),
  dateCreated: attr('date'),
  lastUpdated: attr('date'),
  regions: hasMany('region')
});

And the model for region is:

export default Model.extend({
  name: attr('string'),
  dateCreated: attr('date'),
  lastUpdated: attr('date'),
  brand: belongsTo('brand')
});

Now, when trying to access /brands I am doing this in the route:

export default Ember.Route.extend({
  model() {
    return this.store.findAll('brand');
  }
});

I am getting the following error:

You need to pass a model name to the store's modelFor method

This worked prior to adding the brand route and region relationships. Brand is the parent, so I'm not sure why this isn't working.




Aucun commentaire:

Enregistrer un commentaire