I\'ve been struggling for the past few days with primary keys and the last version of Ember Data.
I first read how to do it on the
I use MongoDB and Ember-Data 1.0.0-beta.6 in my application and the _id posed a problem in Ember 1.4.0 for me too. Here's what I've done to solve the problem, assuming the returned JSON array is nested in the root property "people":
App.ApplicationSerializer = DS.RESTSerializer.extend({
normalizeHash: {
people: function(hash) {
hash.id = hash._id;
delete hash._id;
return hash;
}
}
});
This is, of course, an application-wide serializer but you can limit it to a specific path with something like App.MyPathSerializer = DS.RESTSerializer.extend({ ... });