According to the test implemented in ember-data, when we request child records from the hasMany relationship, the store receives a GET for the URLs of the child resources and sends the identifiers of the necessary child resources.
test("finding many people by a list of IDs", function() {
store.load(Group, { id: 1, people: [ 1, 2, 3 ] });
var group = store.find(Group, 1);
equal(ajaxUrl, undefined, "no Ajax calls have been made yet");
var people = get(group, 'people');
equal(get(people, 'length'), 3, "there are three people in the association already");
people.forEach(function(person) {
equal(get(person, 'isLoaded'), false, "the person is being loaded");
});
expectUrl("/people");
expectType("GET");
expectData({ ids: [ 1, 2, 3 ] });
How can I also send the parent record identifier (Group)? My server needs this identifier to retrieve the entered record. He needs something like:
expectData({groud_id: the_group_id, ids: [1,2,3] })
source
share