mardi 10 novembre 2015

Ember Data 2.1 polymorphic associations

I've gotten polymorphic associations to work before, but something seems to have changed. We've got a simple setup:

// app/models/source.js
import DS from 'ember-data';

export default DS.Model;

// app/models/fee.js
import Source from './source';

export default Source;

We're using the RESTSerializer and ED 2.1. We've tried both:

{
  source: {
    id: 1,
    type: 'fee'
  }
}

(which results the source relationship being null)

And:

{
  sourceId: 1,
  sourceType: 'fee'
}

(which tries to find the record by querying /sources/1, even though the record is sideloaded)

Any idea what might be going on?

Aucun commentaire:

Enregistrer un commentaire