Search code examples
javascriptjsonember.jsember-dataember-cli

ember-dev-fixtures ERROR: "Assertion Failed: The response from a findAll must be an Array, not undefined"


I am using the ember addon called ember-dev-fixtures, and it throws an error when I try and fetch the array saying that it is not one. The way the blueprint is configured is like so:

fixtures/model-name.js

export default [
  /*{
    id: 1, // all fixtures must have an ID
    title: 'test',
    user: 2, // if it is a relation, put the ID of the related record
    createdAt: '2015-01-26T09:22:17.657Z'
  }*/
];

I have searched everywhere online and no one else seems to have a problem with this addon but me, so I figured I would post here. It seems like a pretty straight forward addon, and Ember usually throws that error when the json is formatted incorrectly. As you can see, I have formatted my json to what the addon blueprint requires, and still I have no luck. Below you will see my fixtures file which is outside of my app directory in the root, as it is suppose to be. Also, I have included my model, and my route, as it seems those are the two that are complaining and have the potential to be incorrect. This is a really a shot in the dark since I assume many have not used this framework, and even less have used this specific addon. Any suggestions, are extremely welcomed.

fixtures/state.js

export default [
  {id: 1, state: 'Alabama', url: 'http://upload.wikimedia.org/wikipedia/commons/5/5c/Flag_of_Alabama.svg', symbol: 'AL'},
  {id: 2,state: 'Alaska', url: 'https://upload.wikimedia.org/wikipedia/commons/e/e6/Flag_of_Alaska.svg', symbol: 'AK'},
  {id: 3,state: 'Arizona', url: 'https://upload.wikimedia.org/wikipedia/commons/9/9d/Flag_of_Arizona.svg', symbol: 'AZ'},
  {id: 4,state: 'Arkansas', url: 'https://upload.wikimedia.org/wikipedia/commons/9/9d/Flag_of_Arkansas.svg', symbol: 'AR'},
  {id: 5,state: 'California', url: 'https://upload.wikimedia.org/wikipedia/commons/0/01/Flag_of_California.svg', symbol: 'CA'},
  {id: 6,state: 'Colorado', url: 'https://upload.wikimedia.org/wikipedia/commons/4/46/Flag_of_Colorado.svg', symbol: 'CO'},
  {id: 7,state: 'Connecticut', url: 'https://upload.wikimedia.org/wikipedia/commons/9/96/Flag_of_Connecticut.svg', symbol: 'CT'},
  {id: 8,state: 'Delaware', url: 'https://upload.wikimedia.org/wikipedia/commons/c/c6/Flag_of_Delaware.svg', symbol: 'DE'}
..........
];

routes/select-state.js

import Ember from 'ember';

export default Ember.Route.extend({
    model: function () {
      return this.store.find('state');
    }
});

models/state.js

import DS from 'ember-data';

export default DS.Model.extend({
  state: DS.attr('string'),
  url: DS.attr('string'),
  symbol: DS.attr('string')
});

Solution

  • This bug was fixed with 0.0.7. The issue was posted here: github.com/huafu/ember-dev-fixtures/issues/1