Forum: Rails-core (closed, excessive spam) ActiveRecord find :include appears broken in 9216 gems

69f4b9b411dfcaebe01d0fde8c751726?d=identicon&s=25 Nate Wiger (Guest)
on 2008-04-19 22:17
(Received via mailing list)
Perhaps due to the very nice batch fetch and update changes that were
introduced into core recently:

http://groups.google.com/group/rubyonrails-core/br...

The find :include option appears to be completely ignored now, as of
the 9216 gems.  This example:

   @lobby_channels = find(:all, :include => [:players])

Does two SQL calls:

   SELECT * from lobby_channels

Then on the first missing player:

   SELECT * from players WHERE id IN (115,610,1982)

The new behavior of the bulk fetch is very nice, but the :include
needs to still work for the case when you know you need other models
ahead of time (saves DB load).

Is this a known issue? Couldn't find it browing the git commits...

Thanks,
Nate
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-04-20 01:12
(Received via mailing list)
On Apr 19, 9:17 pm, Nate Wiger <nwi...@gmail.com> wrote:
   @lobby_channels = find(:all, :include => [:players])
> needs to still work for the case when you know you need other models
> ahead of time (saves DB load).
>
> Is this a known issue? Couldn't find it browing the git commits...

This isn't a recent change and it is deliberate (it falls back to the
old implementation if the conditions or order reference one of
the :included tables. The rest of the time the bulk fetch is the new
implementation of :include.

Fred
This topic is locked and can not be replied to.