dimanche 26 juillet 2015

find and findAll return an empty array

In an ember 1.13.3 app, I have this route :

import Ember from 'ember';

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

And this model :

import DS from 'ember-data';

export default DS.Model.extend({
  name: DS.attr('string'),
  description: DS.attr('string'),
  link: DS.attr('string'),
  acquired_skills: DS.hasMany('users', { async: true, inverse: 'acquired_skills' } ),
  searched_skills: DS.hasMany('users', { async: true, inverse: 'searched_skills' } )
});

This is the result returned by the api :

{"skills":[{"id":1,"name":"Ember","description":"JS Framework","link":null}]}

The array is empty. I can check it with this console.log(this.store.find('skill').get('length')); and I have 0.

What's wrong?




Aucun commentaire:

Enregistrer un commentaire