Persisting nested relationships


I am trying to use ember-data to persist object to my back-end API. I am using the RESTAdapter and JSONSerializer as JSON-API does not fit my API’s design.

The API I am posting to is to create a credit application. It uses, extensively, nested objects to encapsulate things like the multiple sets of “Contacts” that might be include with the application.

My Ember model has these relationships defined as has_many and belongs_to much like you would in Rails.

My question is, how do I get Ember-data to submit all of the object (including it’s nested components) in a single URL call? It seems to expect that it will need to make recursive API calls for each of the nested objects after the parent is done. That results in excessive network calls that aren’t needed when the back-end API can accept all of the data in a single POST.


Give the EmbeddedRecordsMixin a try. It specifically allows for what you’ve described.