diff --git a/addon/serializers/rest.js b/addon/serializers/rest.js index f10533fd614..fa3dc9e756c 100644 --- a/addon/serializers/rest.js +++ b/addon/serializers/rest.js @@ -762,24 +762,6 @@ const RESTSerializer = JSONSerializer.extend({ let typeKey = this.keyForPolymorphicType(key, relationship.type, 'serialize'); let belongsTo = snapshot.belongsTo(key); - // old way of getting the key for the polymorphic type - key = this.keyForAttribute ? this.keyForAttribute(key, "serialize") : key; - key = `${key}Type`; - - // The old way of serializing the type of a polymorphic record used - // `keyForAttribute`, which is not correct. The next code checks if the old - // way is used and if it differs from the new way of using - // `keyForPolymorphicType`. If this is the case, a deprecation warning is - // logged and the old way is restored (so nothing breaks). - if (key !== typeKey && this.keyForPolymorphicType === RESTSerializer.prototype.keyForPolymorphicType) { - deprecate("The key to serialize the type of a polymorphic record is created via keyForAttribute which has been deprecated. Use the keyForPolymorphicType hook instead.", false, { - id: 'ds.rest-serializer.deprecated-key-for-polymorphic-type', - until: '3.0.0' - }); - - typeKey = key; - } - if (isNone(belongsTo)) { json[typeKey] = null; } else { diff --git a/tests/integration/serializers/rest-serializer-test.js b/tests/integration/serializers/rest-serializer-test.js index f2aca2c68ae..8516c28d9e5 100644 --- a/tests/integration/serializers/rest-serializer-test.js +++ b/tests/integration/serializers/rest-serializer-test.js @@ -573,27 +573,6 @@ test('serializeBelongsTo with async polymorphic', function(assert) { assert.deepEqual(json, expected, 'returned JSON is correct'); }); -testInDebug('serializeBelongsTo logs deprecation when old behavior for getting polymorphic type key is used', function(assert) { - var evilMinion, doomsdayDevice; - var json = {}; - var expected = { evilMinion: '1', myCustomKeyType: 'evilMinion' }; - - env.restSerializer.keyForAttribute = function() { - return 'myCustomKey'; - }; - - run(function() { - evilMinion = env.store.createRecord('evil-minion', { id: 1, name: 'Tomster' }); - doomsdayDevice = env.store.createRecord('doomsday-device', { id: 2, name: 'Yehuda', evilMinion: evilMinion }); - }); - - assert.expectDeprecation(function() { - env.restSerializer.serializeBelongsTo(doomsdayDevice._createSnapshot(), json, { key: 'evilMinion', options: { polymorphic: true, async: true } }); - }, "The key to serialize the type of a polymorphic record is created via keyForAttribute which has been deprecated. Use the keyForPolymorphicType hook instead."); - - assert.deepEqual(json, expected, 'returned JSON is correct'); -}); - test('keyForPolymorphicType can be used to overwrite how the type of a polymorphic record is serialized', function(assert) { var evilMinion, doomsdayDevice; var json = {};