Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Partial update in Ember-Data?

Imagine a bug tracker.

Each ticket contains a lot of data. Now the status of a few tickets from a long list of tickets is updated.

App.Ticket = DS.Model.extend({
    id: DS.attr('number'),
    status: DS.attr('string'),
    ...
});

Currently when invoking save in ember-data this would send the complete models to the server.

What can I do to only send a partial update, like [{"id": 1, "status": "closed"}, {...}]?

PS: I understand that this is not possible right now, so I'm wondering if there is a workaround / modification that would enable this? (a general-purpose solution is not required).

like image 982
stephanos Avatar asked Feb 23 '13 13:02

stephanos


1 Answers

My current workaround is to specify a readOnly option that excludes the attributes that I don't want to be sent in the POST.

Details can be found here: https://github.com/emberjs/data/pull/303#issuecomment-13993905

like image 134
stephanos Avatar answered Sep 23 '22 11:09

stephanos