Limited eager loads and conditions on the eager tables


#1

Hi,

Why are limited eager loads and conditions on the eager tables
incompatible?

Doing a find(:all) without :include causes a select * query to be
generated,
which means the id fields everwrite each other if associated tables are
included using :joins.

But using :include, if conditions are placed on the tables listed in
:joins
then Rails throws an exception when :limit is included too.

Ordinarily I’d just leave out the limit, but I’m populating a div of
limited
size with draggables so I can’t have overflow set to auto, or they can’t
be
dragged out of the div…

Anyone have any suggestions as to how to use conditions on joined tables
with
limits as well? I’m thinking I might have to use :joins with :select and
name
the columns specifically, but it makes for messy code.

thanks,
mark