Forum: Ruby on Rails Limit Eager Loading?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Mario G. (Guest)
on 2009-03-09 19:48
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
Frederick C. (Guest)
on 2009-03-09 19:52
(Received via mailing list)
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
This topic is locked and can not be replied to.