mercredi 23 mars 2016

Nested Polymorphic Associations Ember

I have the following JSON body that I need to turn into properly associated Ember Models. contents:[{ id: 1, contentable: { type: "comment", id: 2, user: {id: 3, name: "Hal"} } }]

So from this response I need to figure out the proper serializer and model configuration to get one Content model instance. One Comment model instance from the polymorphic contentable embedded relationship. Additionally I also need a user associated with the comment/contentable.

Does anyone know the proper ember way to do this? I have complete control over the server side if it needs to change.




Aucun commentaire:

Enregistrer un commentaire