I'm creating a dashboard for which I use eager loading. For each team I eager load the events. In my dashboard I'm interested in having the whole list of events, but I also want to select the next upcoming event for each event.type.
Where should I define the filter for the collection? I used to define several functions on my Team model, however this resulted in eager loading and executing a lot of queries while I already retrieved all the Events for that team.