# Limit Eager Loading?

**URL:** <https://www.ruby-forum.com/t/limit-eager-loading/162413>\
**Category:** Rails\
**Created:** [March 9, 2009, 6:48pm UTC](https://www.ruby-forum.com/t/limit-eager-loading/162413 "2009-03-09T18:48:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgiorno](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mgiorno](https://www.ruby-forum.com/u/mgiorno)\
**Post date:** [March 9, 2009, 6:48pm UTC](https://www.ruby-forum.com/t/limit-eager-loading/162413/1 "2009-03-09T18:48:25Z")

</div>

Is there a way to limit eager loading? I want to feature categories,  
each with three Items from that category. Is there anyway to do that  
with eager loading or would you recommend a different method?

Thanks!

-Mario

---

<div class="post-metadata">

**Author:** ![mgiorno](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mgiorno](https://www.ruby-forum.com/u/mgiorno)\
**Post date:** [March 9, 2009, 6:52pm UTC](https://www.ruby-forum.com/t/limit-eager-loading/162413/2 "2009-03-09T18:52:48Z")

</div>

On 9 Mar 2009, at 17:48, Mario F. wrote:

> Is there a way to limit eager loading? I want to feature categories,  
> each with three Items from that category. Is there anyway to do that  
> with eager loading or would you recommend a different method?

Not unless you can express that limit as an sql condition.  
fundamentally eager loading can’t do limits on the number of child  
records retrieved (at least not without doing it the dumb way ie  
loading all associated records and then using ruby to throw away the  
extra ones).

Fred
