@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/identitylike 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
organizationrelationships, and this is because they are on a different service and theaccountservice doesn’t know anything about theorgservice. But I was hoping i could override theurlForFindHasManyand tell ember data where to load the organizations from. However when I do:
const organizations = await identity.get("organizations");My
urlForFindHasManymethod 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