# Ember data doesn't load relationship

**URL:** <https://discuss.emberjs.com/t/ember-data-doesnt-load-relationship/14405>\
**Category:** Ember Data\
**Created:** [March 16, 2018, 6:09am UTC](https://discuss.emberjs.com/t/ember-data-doesnt-load-relationship/14405 "2018-03-16T06:09:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ruslan\_U\_Zakirov](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/ruslan_u_zakirov/32/13064_2.png) [@Ruslan\_U\_Zakirov](https://discuss.emberjs.com/u/Ruslan_U_Zakirov)\
**Post date:** [March 16, 2018, 6:09am UTC](https://discuss.emberjs.com/t/ember-data-doesnt-load-relationship/14405/1 "2018-03-16T06:09:45Z")

</div>

match model hasMany room. router’s model hook loads a match and some rooms of this match using store.query(). These are not all rooms of the match, however ember decides that match.rooms relationship is loaded.

Can I do something to avoid the problem?

UPDATE: More on the issue. Route:

```
export default Ember.Route.extend({
  session: Ember.inject.service(),
  model (params) {
    return Ember.RSVP.hash({
      match: this.store.findRecord('match', params.match_id),
      userRooms: this.get('session.currentUser').then((user) => {
        return this.store.query( 'room', { "with_user": user.get('id'), "match_id": params.match_id } );
      }),
    });
  },
});

```

After adding userRooms to the model hook match.rooms has the same set of rooms as userRooms and this is not correct.

---

<div class="post-metadata">

**Author:** ![broerse](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/broerse/32/9497_2.png) [@broerse](https://discuss.emberjs.com/u/broerse)\
**Post date:** [March 16, 2018, 6:29am UTC](https://discuss.emberjs.com/t/ember-data-doesnt-load-relationship/14405/2 "2018-03-16T06:29:24Z")

</div>

Not sure I understand the question but sometimes you need to load relations like `rooms` with `setupController` like `author` is done here:

> <https://github.com/broerse/ember-cli-blog/blob/master/app/routes/posts.js#L7>

---

<div class="post-metadata">

**Author:** ![Ruslan\_U\_Zakirov](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/ruslan_u_zakirov/32/13064_2.png) [@Ruslan\_U\_Zakirov](https://discuss.emberjs.com/u/Ruslan_U_Zakirov)\
**Post date:** [March 16, 2018, 5:11pm UTC](https://discuss.emberjs.com/t/ember-data-doesnt-load-relationship/14405/3 "2018-03-16T17:11:34Z")

</div>

Updated original question with more information.
