[SOLVED] Count the total records in a Fixture


#1

How does one detect how many items are in a DS Store?

E.g. if i was given a fixture like so:

App.Category.FIXTURES = [
  {
    id: 1,
    categoryName: 'Category No.1',
    description: 'This is Category No.1'
  }, {
    id: 2,
    categoryName: 'Category No.2',
    description: 'This is Category No.2'
  }, {
    id: 3,
    categoryName: 'Category No.3',
    description: 'This is Category No.3'
  }, {
    id: 4,
    categoryName: 'Category No.4',
    description: 'This is Category No.4'
  }
];

How does one count how many items are in the fixture ? I can’t rely on the ID because some categories might be deleted right?


#2

You can count all entries contained in the store:

this.store.all('category').get('length')