@niltz wrote:
I have an ember data model that looks like this (note that I am using
typed-ember/ember-cli-typescript
)import DS from "ember-data"; export default class AccountIdentity extends DS.Model.extend({ organizations: DS.hasMany("org/organization", { async: true }) }) { // normal class body definition here } // DO NOT DELETE: this is how TypeScript knows how to look up your models. declare module "ember-data/types/registries/model" { export default interface ModelRegistry { "account/identity": AccountIdentity; } }
Then I load my
account/identity
like so:
const identity = this.store.findRecord("account/identity", "abc")
Which calls the api, and the api returns:
{ "data": { "type": "account/identities", "id": "abc" } }
Note how the response doesn’t contain any
organization
relationships, and this is because they are on a different service and theaccount
service doesn’t know anything about theorg
service. But I was hoping i could override theurlForFindHasMany
and tell ember data where to load the organizations from. However when I do:
const organizations = await identity.get("organizations");
My
urlForFindHasMany
method isn’t called, nor is any other API call of any kind. How can I tell/force ember data to load the relationship data?
Posts: 1
Participants: 1