I feel not sure where do I place eager loadings(
eager_load) responsibility in my rails app. Most of the time, we need eager loadings when we display on views, but all data should load in controller action. I feel pain when I put it that responsibility in controller action because it makes the controller action not clean and hard to stub their interface when we do testing, and also it will have some duplication when we need that for multiple places. When I move that responsibility into model’s association themselves, then I don’t feel good either because I found out not all places that I call associations need to do eager loadings.
What’s your style/convention for this problem?