Skip to content

Embeded relationship data not loading #16

Open
@Subaku

Description

@Subaku

Hello,

Have an issue I don't understand. I've an Ember-Data model, AssetLocation that has several belongsTo relationships. I can get one relationship to load data but the others don't. I confirmed that the mirage server is creating the data behind the scenes so I think this is a config or serialization issue.

Here's my Mirage serializer for the model.

import ApplicationSerializer from './application';

export default class AssetLocationSerializer extends ApplicationSerializer {
  root = false;
  embed = true;
  include = ['location', 'asset', 'assignedTo', 'seenBy'];
}

Here the actual Ember-Data serializer for the same model.

import DS from "ember-data";
import ApplicationSerializer from './application';

const { EmbeddedRecordsMixin } = DS;


export default class AssetLocationSerializer extends ApplicationSerializer.extend(EmbeddedRecordsMixin) {
  attrs = {
    asset: { embedded: 'always' },
    assignedTo: { embedded: 'always' },
    location: { embedded: 'always' },
    seenBy: { embedded: 'always' },
  }
}

Here's a sample request made from my app.
image

The embedded assets get created just fine. It's the others that don't. So assignedTo and seenBy for example never get created in the store. Am I missing something here?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions