vendredi 14 octobre 2016

How can I get the relationships of a resource in an Ember route?

I have this code in an Ember route:

let forum = this.store.findRecord('forum', 'main').then(function(forum) {
  console.log('FORUM:', forum);
  let categories = forum.get('categories');
  console.log('CATEGORIES:', categories);
});

return forum;

This console returns this:

FORUM: Object { store: Object, _internalModel: Object, id: Getter, currentState: Object, isError: false, adapterError: null, OWNER [id=__ember1476462923058714220863537]: Object, _super: ROOT(), 2 more… }

CATEGORIES: undefined

Obvisouly, a request is made to /forums/main, but nothing after that. What is the role of forum.get('categories')? How am I supposed to get the relationships of a resource? Shouldn't that request /forums/main/categories?




Aucun commentaire:

Enregistrer un commentaire