Saving Models and Their Relationships Using the New Ember Data JSONAPISerializer / Adapter

I have implemented a JSON-API backend and I am using ember (1.13.4) and ember data (1.13.5) to pull my data into the store using the new JSONAPIAdapter / JSONAPISerializer. Everything works well and the store fills all the models and their attributes / relationships.

However, when I call the .save () method on my models, the JSON-API formatted request that is not generated does not contain an "included" key with all of its associated models inside it. This means that if I change an attribute in the linked model and then save the main model, I cannot see the changed attribute from the linked model in the JSON payload.

What is the correct way to save the models and their relationships so that they are inlined with the new JSONAPIAdapter / JSONAPISerializer? I tried EmbeddedRecordsMixin, but it resulted in zero attribute values ​​in the "attributes" of the payload key.

If anyone can help me I would be grateful.

Thank.

+3


source to share


1 answer


Ok, the answer was given on the Ember forum:

"The standard does not support this at the moment and is planned for v1.1 ( http://discuss.jsonapi.org/t/json-api-weekly-meeting-june-22nd-2015/23 ).

Your best bet is to inherit from serializer and implement your own standard for now. Just remember to include the included paths in your url so your server can respond to all updated entities.



More information can be found here .

+1


source







All Articles