O'Reilly logo

Mastering Ember.js by Mitchel Kelonye

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Customizing a store's serializer

In addition to a store's adapter, all stores have a serializer that serializes and deserializes data that comes in and out of the application. For example, if the data models in our backend use primary keys other than id, we can easily do this:

DS.RESTSerializer.reopen({
  primaryKey: 'key'
});

Note that this could also be specified per model, as follows:

App.PhoneSerializer = DS.RESTSerializer.extend({
  primaryKey: 'phone_id'
});

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required