EmberJS model was not found, but she is there

I am writing an ember-cli application. I have the following model:

// app/models/school.js
export default DS.Model.extend({
  name: DS.attr('string', { defaultValue: '' })
});

It was generated using the ember generator, like all my other models. It has a unit test function as well as tests for the default value for the name attribute. All tests are green until another model is in school:

// app/models/professor.js
export default DS.Model.extend({
  name: DS.attr('string', { defaultValue: '' }),
  email: DS.attr('string', { defaultValue: '' }),

  courses: DS.hasMany('course'),
  posts: DS.hasMany('post'),
  school: DS.belongsTo('school')
});

This test is completely green until I add the school attribute. It is even green with 'model:school', defined in the needshelper array moduleForModel:

// tests/unit/models/professor-test.js
// this is green w/o belongsTo('school') in the model
moduleForModel('professor', {
  // Specify the other units that are required for this test.
  needs: ['model:school', 'model:post', 'model:course']
});

The error I get is:

Error: No model was found for 'school'

Here is the model catalog

$ ls app/models/
course.js  post.js  professor.js  school.js  student.js

Why doesn't he find my model?

+4
source share
1 answer

:

import '[appName]/models/school';
-2

All Articles