Hi,
If I use :include to eager load a has_many association, can I limit the number returned on that has_many association. I know I can limit the amount of records returned, but how do I limit how many are returned on its association?
If there is a way of limiting the includes explicitely when using the finder, I'm not aware of it.But you can use :limit as one of the options when you are defining the has_many association itself at the model, so you could so something like:
has_many :detail_items, :limit=>10
There are also a number of other options you can use to further selecting which of the detail_items will be retrieved for this association, like :order or :select.
Regards,
javier ramirez