Skip to content

Not loading relationships #11

@pedropaf

Description

@pedropaf

Hi, I'm using this adapter for an ember-cli 2.6 app. And I'm using .NET Web API.

I have 2 models:

Team:

export default Model.extend(Validations, {
  name: attr(),
  teamLeader: belongsTo('user', { inverse: null }),
  users: hasMany('user'),
});

User:

export default Model.extend({
  firstName: attr(),
  lastName: attr(),
  team: belongsTo('team', { inverse: 'users' })
});

On my index route, I request to get all teams, and I have this response from the API:

[
  {
    "id": 1,
    "name": "Inbound",
    "teamLeader": 9000,
    "users": []
  },
  {
    "id": 4,
    "name": "Energy Renewals",
    "teamLeader": 9000,
    "users": []
  }
]

I can render the list of teams, but there's no request to the API to get the TeamLeader details. So if I try to render the name of the TeamLeader, it's always empty. I'm following all Ember Data and Ember Rest Adapter documentation and I can't find anything wrong. Any ideas?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions