Reputation: 9
I am using the ember 1.8.1, ember data 1.0.0-beta 11. I have two types name A and B the relationship is like
A = DS.Model.extend({
bs: DS.hasMany('B', {async: true})
});
B = DS.Model.extend({
a: DS.belongsTo('A')
});
According this post: http://thau.me/2014/09/ember-data-mastering-async-relationships/
When I try to fetch the bs in a.model in template like this: {{#each b in model.bs}}
The ember's RESTAdapter will send a http request like this: URL/bs?ids[]=1&ids[]=2
But it will send several request like this: URL/b/1 URL/b/2
Is the behavior of ember data changed in new version? How can I combine the requests to 1 request?
Upvotes: 0
Views: 221
Reputation: 473
This behaviour changed in Ember Data beta-9 to be opt-in.
You can activate it by setting the coalesceFindRequests
property of your adapter.
DS.RESTAdapter.reopen({
coalesceFindRequests: true
});
A more detailed description can be found in the offical blog entry for beta-9: http://emberjs.com/blog/2014/08/18/ember-data-1-0-beta-9-released.html#toc_coalescing-find-requests
Upvotes: 0