lundi 23 mai 2016

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

Pretty new to Ember so maybe someone can help me out. I keep running across this error and have no idea how to solve it.

Ember             : 2.5.1
Ember Data        : 2.5.3

Below is my router.js.

//app/router.js
import Ember from 'ember';
import config from './config/environment';

const Router = Ember.Router.extend({
  location: config.locationType
});

Router.map(function() {
  this.route('organization', {path: '/organization/:id'}, function(){
    this.route('about', { path: '/about' });
    this.route('admin', { path: '/admin' }, function(){
        this.route('team', { path: '/team/:team_id' });
    });
  });
});

The organization/:id/about and organization/:id/admin routes work fine. But when I try to load the organization/:id/admin/team/:team_id route, the error is thrown. Below is the routes/organization/admin/team.js file:

//app/routes/organization/admin/team.js
import Ember from 'ember';

export default Ember.Route.extend({

    model(params) {
        let organization = this.modelFor('organization');
        return organization.get('team');
    }

});

Not really sure what other information I should post, so please ask for any additional information you may think is necessary to help debug. My guess is it's something pretty simple and I'm completely oblivious to it.




Aucun commentaire:

Enregistrer un commentaire