emberjs/data — pull request #2152 by jbourassa (2014-08-01 15:30:27+00:00)
Title: Add support for embedded polymorphic hasMany

So this is my stab at adding support for embedded polymorphic hasMany relations (fixing #2114). This basically changes the default loading behaviour from using the hasMany target to using the `type` attribute, and also relies on the fact that `deserializeRecordId` accepts a `{ id: 1, type: 'class' }` object.

I am very unfamiliar with ember-data therefore I do not expect this will be merged as is, but feedback would be very appreciated. There are a couple things that I think need to be improved but I'm not sure if these concepts already exist somewhere or I should implement them specifically for the EmbeddedRecordMixin:

- Allowing the type attribute to be customized, instead of hardcoding `payload.type`.
- Allowing the [typeKey](https://github.com/hooktstudios/data/commit/727e2765d4423356b9e6734f340da6d2edcd9a52#diff-c93c581330905490c1e2d5cf47c8cc63R435) to be customized in the serialization process (use case: the API could send a `Namespace::Class` and the client might only be interested in the `Class`).
- Serializing back the `type` attribute. For now, deserializing changes `LightSaber` to `lightSaber`, but serializing _does not_ change `lightSaber` back to `LightSaber`.

Any feedback would be great, especially on how to tackle the listed points.