Skip to content

Commit

Permalink
Merge pull request #3392 from artych/master
Browse files Browse the repository at this point in the history
AMS modelNameFromPayloadKey and serializePolymorphicType cleanup
  • Loading branch information
wecc committed Jun 19, 2015
2 parents c04913b + 08e714e commit cafddd1
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,7 @@ var ActiveModelSerializer = RESTSerializer.extend({
if (Ember.isNone(belongsTo)) {
json[jsonKey] = null;
} else {
json[jsonKey] = classify(belongsTo.modelName).replace(/(\/)([a-z])/g, function(match, separator, chr) {
return match.toUpperCase();
}).replace('/', '::');
json[jsonKey] = classify(belongsTo.modelName).replace('/', '::');
}
},

Expand Down Expand Up @@ -295,9 +293,7 @@ var ActiveModelSerializer = RESTSerializer.extend({
}
},
modelNameFromPayloadKey: function(key) {
var convertedFromRubyModule = camelize(singularize(key)).replace(/(^|\:)([A-Z])/g, function(match, separator, chr) {
return match.toLowerCase();
}).replace('::', '/');
var convertedFromRubyModule = singularize(key.replace('::', '/'));
return normalizeModelName(convertedFromRubyModule);
}
});
Expand Down

0 comments on commit cafddd1

Please sign in to comment.