keyForPolymorphicType (key, typeClass, method) String
keyForPolymorphicType
can be used to define a custom key when serializing and deserializing a polymorphic type. By default, the returned key is ${key}Type
.
Example
app/serializers/post.js
import DS from 'ember-data'; export default DS.RESTSerializer.extend({ keyForPolymorphicType: function(key, relationship) { var relationshipKey = this.keyForRelationship(key); return 'type-' + relationshipKey; } });
Parameters:
-
key
String
-
typeClass
String
-
method
String
Returns:
-
String
- normalized key
Please login to continue.