Ember CLI is a useful command-line tool for developing Ember.js applications. If you use it in combination with Ember Data and the
FixtureAdapter there is a possibility you already know the error message Error while loading route: Error: Assertion Failed: Unable to find fixtures for model type. You can prevent it from happending by using
reopenClass to define your fixtures.
The official Ember.js website and most tutorials you can find online show you code examples where the
FIXTURES attribute is set directly on the model. In combination with the
Ember.MODEL_FACTORY_INJECTIONS flag above mentioned error can happen. Since Ember CLI sets this exact flag you run into this error.
The correct way of defining fixtures uses the
reopenClass method. It's very easy to use it for setting the
FIXTURES attribute as you can see in the following example.
Du kannst diesen Beitrag auch auf Deutsch lesen: Fixtures in Kombination mit Ember CLI verwenden.