mercredi 19 juillet 2017

How to access nested resources in API

I have a Ember app that uses a Rails API. I have a teams table and a referees table, both link to another table called refereeTeamStats. I am trying to get all the refereeTeamStats for a team and include the referee resource so I can get the referee's name. In short, I need my Ember app to call /teams/:team_id/refereeTeamStats?include=referee Initially I had my app get the refereeTeamStats through the route by doing this:

model() {
  return this.modelFor('teams/show').get('refereeTeamStats');
}

This will call /teams/:team_id/refereeTeamStats however, this will not include the referee resource. What is the best way that I can get the refereeTeamStats with including a resource (referee) on a nested resource (refereeTeamStats)?




Aucun commentaire:

Enregistrer un commentaire