{"action":"created","issue":{"url":"https://api.github.com/repos/emberjs/data/issues/3414","labels_url":"https://api.github.com/repos/emberjs/data/issues/3414/labels{/name}","comments_url":"https://api.github.com/repos/emberjs/data/issues/3414/comments","events_url":"https://api.github.com/repos/emberjs/data/issues/3414/events","html_url":"https://github.com/emberjs/data/issues/3414","id":90134026,"number":3414,"title":"Issue with polymorphic type on 1.13","user":{"login":"jcope2013","id":3374461,"avatar_url":"https://avatars.githubusercontent.com/u/3374461?v=3","gravatar_id":"","url":"https://api.github.com/users/jcope2013","html_url":"https://github.com/jcope2013","followers_url":"https://api.github.com/users/jcope2013/followers","following_url":"https://api.github.com/users/jcope2013/following{/other_user}","gists_url":"https://api.github.com/users/jcope2013/gists{/gist_id}","starred_url":"https://api.github.com/users/jcope2013/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcope2013/subscriptions","organizations_url":"https://api.github.com/users/jcope2013/orgs","repos_url":"https://api.github.com/users/jcope2013/repos","events_url":"https://api.github.com/users/jcope2013/events{/privacy}","received_events_url":"https://api.github.com/users/jcope2013/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-06-22T15:34:57Z","updated_at":"2015-06-23T22:36:47Z","closed_at":null,"body":"i have an object that looks like this returned from the response, it is sideloaded\r\n\r\n```\r\n\r\npatient_plans: [{\r\nid: 3, \r\nmember_id: \"43\", \r\nfirst_name: \"test\",\r\ncreated_at: \"2015-06-22T10:28:11.084-04:00\"\r\ndate_of_birth: \"2015-02-25\"\r\ntype: \"RegularPatientPlan\"\r\nupdated_at: \"2015-06-22T10:28:11.084-04:00\"\r\n}]\r\n\r\n```\r\n\r\nbut when it comes into the store push method\r\n\r\n```\r\n{\r\n    data: {\r\n    attributes: Object\r\n    id: \"3\"\r\n    relationships: Object\r\n    type: \"patient-plan\"\r\n    }\r\n}\r\n```\r\n\r\nthe type doesnt seem to be getting coerced correctly and there doesnt seem to be a place i can grab the type off attributes either as i would expect it to be type regular-patient-plan\r\n\r\ni am on canary and using new serializer api, for reference this was working up until 1.13 \r\n\r\nalso mentioned here https://github.com/emberjs/data/issues/2749 @jackmatt2 you get it working?"},"comment":{"url":"https://api.github.com/repos/emberjs/data/issues/comments/114661591","html_url":"https://github.com/emberjs/data/issues/3414#issuecomment-114661591","issue_url":"https://api.github.com/repos/emberjs/data/issues/3414","id":114661591,"user":{"login":"jcope2013","id":3374461,"avatar_url":"https://avatars.githubusercontent.com/u/3374461?v=3","gravatar_id":"","url":"https://api.github.com/users/jcope2013","html_url":"https://github.com/jcope2013","followers_url":"https://api.github.com/users/jcope2013/followers","following_url":"https://api.github.com/users/jcope2013/following{/other_user}","gists_url":"https://api.github.com/users/jcope2013/gists{/gist_id}","starred_url":"https://api.github.com/users/jcope2013/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcope2013/subscriptions","organizations_url":"https://api.github.com/users/jcope2013/orgs","repos_url":"https://api.github.com/users/jcope2013/repos","events_url":"https://api.github.com/users/jcope2013/events{/privacy}","received_events_url":"https://api.github.com/users/jcope2013/received_events","type":"User","site_admin":false},"created_at":"2015-06-23T22:36:47Z","updated_at":"2015-06-23T22:36:47Z","body":"@jackmatt2 this seems to be working with my testing so far, you might be able to get rid of the second else, its legacy at this point and i have a length check which will prolly not be needed after https://github.com/emberjs/data/issues/3425 gets fixed, just stick type: DS.attr('string') on the root model that the polymorphic ones extend from \r\n\r\n```\r\nexport default DS.Store.extend({\r\n push : function(type, data) {\r\n    var dataType, modelType, oldRecord, oldType;\r\n    if(type.data)\r\n    {\r\n      if(Ember.isArray(type.data) && type.data.length === 0)\r\n      {\r\n        return this._super(type, data);\r\n      }\r\n      else\r\n      {\r\n        modelType = oldType = type.data.type;\r\n\r\n        if(type.data.attributes.type)\r\n        {\r\n          dataType = type.data.attributes.type.dasherize(); \r\n        }\r\n\r\n        if(dataType && (this.modelFor(oldType) !== this.modelFor(dataType))) {\r\n          type.data.type = dataType;\r\n\r\n          if(oldRecord = this.peekRecord(oldType, type.data.id)) {\r\n            this.unloadRecord(oldRecord);\r\n          }\r\n\r\n        }\r\n\r\n        return this._super(type, data);\r\n      }\r\n    }\r\n    else\r\n    {\r\n      modelType = oldType = type;\r\n      if(data)\r\n      {\r\n        dataType = data.type; //The type parameter is required in the payload with the subclass name\r\n      }\r\n\r\n      if(dataType && (this.modelFor(oldType) !== this.modelFor(dataType))) {\r\n        modelType = dataType;\r\n\r\n        if(oldRecord = this.peekRecord(oldType, data.id)) {\r\n          this.unloadRecord(oldRecord);\r\n        }\r\n\r\n      }\r\n\r\n      return this._super(modelType, data);\r\n    }\r\n  }\r\n});\r\n```"}}