Skip to content

Commit

Permalink
Serializer keys are conceptually distinct from recordTypeName.
Browse files Browse the repository at this point in the history
  • Loading branch information
rsutphin committed Jun 8, 2015
1 parent 8aa35df commit 4b33181
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions addon/adapters/pouch.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,12 @@ export default DS.RESTAdapter.extend({

_recordToData: function (store, type, record) {
var data = {};
var recordTypeName = this.getRecordTypeName(type);
var serializer = store.serializerFor(recordTypeName);
// Though it would work to use the default recordTypeName for modelName &
// serializerKey here, these uses are conceptually distinct and may vary
// independently.
var modelName = type.modelName || type.typeKey;
var serializerKey = camelize(modelName);
var serializer = store.serializerFor(modelName);

var recordToStore = record;
// In Ember-Data beta.15, we need to take a snapshot. See issue #45.
Expand All @@ -152,7 +156,7 @@ export default DS.RESTAdapter.extend({
{includeId: true}
);

data = data[recordTypeName];
data = data[serializerKey];

// ember sets it to null automatically. don't need it.
if (data.rev === null) {
Expand Down

0 comments on commit 4b33181

Please sign in to comment.