# Can a Model belongTo a number of other models from a single property?

**URL:** <https://discuss.emberjs.com/t/can-a-model-belongto-a-number-of-other-models-from-a-single-property/2878>\
**Category:** Ember Data\
**Created:** [October 4, 2013, 8:49pm UTC](https://discuss.emberjs.com/t/can-a-model-belongto-a-number-of-other-models-from-a-single-property/2878 "2013-10-04T20:49:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kerrick](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/kerrick/32/14915_2.png) [@Kerrick](https://discuss.emberjs.com/u/Kerrick)\
**Post date:** [October 4, 2013, 8:49pm UTC](https://discuss.emberjs.com/t/can-a-model-belongto-a-number-of-other-models-from-a-single-property/2878/1 "2013-10-04T20:49:25Z")

</div>

In this exmaple case, a single `Ball` either `belongsTo` `Football`, or it `belongsTo` `Soccer`.

```nohighlight
App.Football = DS.Model.extend({
    name: DS.attr('string'),
    balls: DS.hasMany('balls', { inverse: 'sport' })
});

```

```nohighlight
App.Soccer = DS.Model.extend({
    name: DS.attr('string'),
    balls: DS.hasMany('balls', { inverse: 'sport' })
});

```

```nohighlight
App.Ball = DS.Model.extend({
    color: DS.attr('string'),
    sport: DS.belongsTo('No idea what goes here', { inverse: 'balls' }),
    sportType: 'No idea what goes here'
});

```

Is there a way to represent this in Ember.js? And would the `Ball` need a `sportType` to differentiate between `store.find('football', 1)` and `store.find('soccer', 1)`?

---

<div class="post-metadata">

**Author:** ![kingpin2k](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/kingpin2k/32/4255_2.png) [@kingpin2k](https://discuss.emberjs.com/u/kingpin2k)\
**Post date:** [October 6, 2013, 4:02pm UTC](https://discuss.emberjs.com/t/can-a-model-belongto-a-number-of-other-models-from-a-single-property/2878/2 "2013-10-06T16:02:23Z")

</div>

It sounds like you are referring to polymorphic associations.

[https://github.com/emberjs/data/pull/750](https://github.com/emberjs/data/pull/750)

---

<div class="post-metadata">

**Author:** ![pwagenet](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/pwagenet/32/14172_2.png) [@pwagenet](https://discuss.emberjs.com/u/pwagenet)\
**Post date:** [October 24, 2013, 5:16pm UTC](https://discuss.emberjs.com/t/can-a-model-belongto-a-number-of-other-models-from-a-single-property/2878/3 "2013-10-24T17:16:00Z")

</div>

This topic was automatically closed after 3 days. New replies are no longer allowed.
