function(type, hash) {
    var payloadKey, payload;

    if (this.keyForRelationship) {
      type.eachRelationship(function(key, relationship) {
        if (relationship.options.polymorphic) {
          payloadKey = this.keyForAttribute(key);
          payload = hash[payloadKey];
          if (payload && payload.type) {
            payload.type = this.typeForRoot(payload.type);
          } else if (payload && relationship.kind === "hasMany") {
            var self = this;
            forEach(payload, function(single) {
              single.type = self.typeForRoot(single.type);
            });
          }
        } else {
          payloadKey = this.keyForRelationship(key, relationship.kind);
          payload = hash[payloadKey];
        }

        hash[key] = payload;

        if (key !== payloadKey) {
          delete hash[payloadKey];
        }
      }, this);
    }
  }
function(type, hash) {
    var payloadKey, payload;

    if (this.keyForRelationship) {
      type.eachRelationship(function(key, relationship) {
        if (relationship.options.polymorphic) {
          payloadKey = this.keyForAttribute(key);
          payload = hash[payloadKey];
          if (payload && payload.type) {
            payload.type = this.typeForRoot(payload.type);
          } else if (payload && relationship.kind === "hasMany") {
            var self = this;
            forEach(payload, function(single) {
              single.type = self.typeForRoot(single.type);
            });
          }
        } else {
          payloadKey = this.keyForRelationship(key, relationship.kind);
          payload = hash[payloadKey];
        }

        hash[key] = payload;

        if (key !== payloadKey) {
          delete hash[payloadKey];
        }
      }, this);
    }
  }
function ( type , hash ) { var payloadKey , payload ; if ( this . keyForRelationship ) { type . eachRelationship ( function ( key , relationship ) { if ( relationship . options . polymorphic ) { payloadKey = this . keyForAttribute ( key ) ; payload = hash [ payloadKey ] ; if ( payload && payload . type ) { payload . type = this . typeForRoot ( payload . type ) ; } else if ( payload && relationship . kind === "hasMany" ) { var self = this ; forEach ( payload , function ( single ) { single . type = self . typeForRoot ( single . type ) ; } ) ; } } else { payloadKey = this . keyForRelationship ( key , relationship . kind ) ; payload = hash [ payloadKey ] ; } hash [ key ] = payload ; if ( key !== payloadKey ) { delete hash [ payloadKey ] ; } } , this ) ; } }
Normalize the polymorphic type from the JSON.

Normalize:
```js
{
id: "1"
minion: { type: "evil_minion", id: "12"}
}
```

To:
```js
{
id: "1"
minion: { type: "evilMinion", id: "12"}
}
```

@method normalizeRelationships
@private
Normalize the polymorphic type from the JSON .