Ember data doesn't load relationship


#1

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.


#2

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


#3

Updated original question with more information.