Using ember data to save multiple records via message

Does anyone know of any working examples of redefining ember-data DS.Adapter data to save all records at once?

I would like to flatten the entire array of records and send them to my server. I don't have much flexibility on the server to use anything other than the existing API, which is just a perl CGI script. Any help in the right direction would be appreciated.

+6
source share
1 answer

What I did was iterate over the ember-data data models, serialize them, save them in a json object that meets the server requirements, and fulfill the send request.

var identifiedResponse = [] this.store.filter(key, function (record) { return !!record.get('name') }).then(function(resp) { identifiedResponse.push(item.serialize()) }) jQuery.ajax({ url: url, type: "POST", data: identifiedResponse, contentType: "application/json", dataType: 'json', xhrFields: { withCredentials: true } }) 
+2
source

All Articles