toranb/ember-data-django-rest-adapter — pull request #31 by craigteegarden (2013-07-29 16:58:01+00:00)
Title: add failing test: when saved, a model with a hasmay relationship does no...

...t send the array of ids to the server.

I noticed an issue where the `hasMany` relationship array of ids is not sent to the server during a `commit()` or `save()`. I added a test showing the same behavior.

In the test the `Group` model is defined as:

Group = DS.Model.extend({
name: DS.attr('string'),
zpeople: DS.hasMany(Person)
});

When we load a model it contains the array of `People` object ids in the `zpeople` array:

store.load(Group, { id: 1, name: "Doe Family", zpeople: [ 1, 2 ] });
group = store.find(Group, 1);
set(group, 'name', 'New Doe Family Name');

However, when we modify the loaded model and then call `store.commit()`, the data has sent to the server only contains the `name` attribute.

![djangorestadaptererror](https://f.cloud.github.com/assets/1930208/873030/61a2a398-f86f-11e2-972f-83a0e8c10ce2.png)

In my real application I am seeing this same behavior. When loading the JSON data from the server the array of ids is present, but when saving it the key is completely missing. This causes the equivalent relationship on the server to be removed.

Am I missing how the hasMany relationship works?