--
Posted via http://www.ruby-forum.com/.
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
However, you might be able emulate the functionality by constructing
your own query to fetch the ids of the association that match. Then
you could put them in a big array and pass them into the conditions on
the final query.
There would be a lot of issues, and it might ultimately be slower than
the n+1 queries. There's no direct way to limit the secondary results
although you might be able to cook something up with subselects or
other advanced db features.
On May 15, 4:03 pm, Aryk Grosz <rails-mailing-l...@andreas-s.net>
wrote:
Have you heard of it working?
I understand the sql for limiting on the association would get a bit
tricky, but I was hoping AR would apply the limit when mapping the
results. Unfortunately it's not.
regards,
javier