Proposal: Batch Saving for RecordArray


After having some issues with long wait times for my saving process I’ve decided to add a batch boolean option to the save function on RecordArrays, as well as a global option to set the default value to true/false.

This option would collect all dirty records in the array and send one or two requests, one to the api batch create route for the resource if there are any new records and one to the api batch update route if there are any updated records.

The format of the data sent would be the same as whatever the adapter/serializer expects to receive for batch finds (i.e. findAll and findQuery). So in the case of the ActiveModel adapter, a batch save would look like so:

    "posts": [
        { "title": "Foo", "text": "..." },
        { "title": "Bar", "text": "..." },
        { "title": "Baz", "text": "..." }

My questions regarding this modification are:

  1. Would this be a useful feature to pull into the main codebase?
  2. If so, does the described process seem adequate?

In addition, since I would be editing some of the relevant parts of the ActiveModel adapter, I was considering bringing it closer to JSONAPI by addressing this issue. I would either include an option to singularize or pluralize (depending on which is default) the single item save. Questions here are:

  1. Is JSONAPI compliance the goal of the ActiveModel adapter?
  2. If so, should the default behavior be to encapsulate all objects in an array w/ a pluralized key, providing an option to singularize OR should it be the reverse?


I would like to see this feature +1


I would like to see this feature as well (+1)


Ember data is conforming to JSON API, which currently doesn’t have this as part of the spec. You can do it through the embedded records mixin, which is how I ended up accomplishing it.