Migrate from 1.6 to 1.8.1 issue


hi, everyone, I’m migrating my project from 1.6 to 1.8.1 (later will migrate to 1.12+). I have two models: form and formSection, defined as:

var attr = DS.attr;
var hasMany = DS.hasMany;

App.Form = DS.Model.extend({
    name: attr('string'),
    doctorEmail: attr('string'),
    sections: hasMany('formSection', { async: true })

App.FormSection = DS.Model.extend({
    name: attr('string'),
    sortOrder: attr('number')

In controller when using 1.6 and making call to form.sections as:

this.get('selectedForm.sections').then(function (sections) {

(“selectedForm” is of type “form”)

Ember made a batch request to get all section as single operation like localhost:59193/formSections?ids[]=32553&ids[]=32554&…

But as when using 1.8.1 ember makes a request per model. Means, if selectedForm has 3 sections I get 3 requests like localhost:59193/formSections/11111, localhost:59193/formSections/22222, localhost:59193/formSections/33333

I would like to make single request to get all sections, instead of making so many requests as how many models are.

I remember I read some time later about some flag which forces the rest adapter use batch request, but I can not find its name and how to specify it. Can you help me?

p.s. I used ember-data-1.0.0-beta.8 with Ember 1.6 and now trying to use ember-data-1.0.0-beta.11 with Ember 1.8.1 p.p.s how to view documentation for older versions of Ember. Currently I see 3 versions: for 1.10, 1.11 and 1.12


I found the solution. Need to set coalesceFindRequests: true for application adapter. It maked the adapter combine the requests into a single one

App.ApplicationAdapter = DS.RESTAdapter.extend({
    coalesceFindRequests: true,