emberjs/data — pull request #750 by Cyril-sf (2013-02-22 23:57:16+00:00)
Title: Added support for polymorphic associations.

```js
App.User = DS.Model.extend({
messages: DS.hasMany(App.Message, {polymorphic: true})
});

App.Message = DS.Model.extend({
created_at: DS.attr('date'),
user: DS.belongsTo(App.User)
});

App.Post = App.Message.extend({
title: DS.attr('string')
});

App.Comment = App.Message.extend({
body: DS.attr('string'),
message: DS.belongsTo(App.Message, {polymorphic: true})
});
```

You need to configure the serializer to map to the correct type:

```js
DS.RESTAdapter.configure('App.Post' {
alias: 'post
});
DS.RESTAdapter.configure('App.Comment' {
alias: 'comment
});
```

Initializing an alias will automatically allow you to sideload this
type. The support for `sideloadAs` is only for backward compatibility.

Embedded polymorphic associations are not supported yet.