Forum: Ruby on Rails Eager Loading: Stacking Includes?

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.
James (Guest)
on 2007-01-30 01:03
Is it possible to stack :include's in a situation like this:

A has_many Bs

B belongs_to A
B has_many Cs

C belongs_to B


The result of the query looking something like...

A.id  B.id  C.id
0     0     0
0     0     1
0     0     2
0     1     0
...
Rick O. (Guest)
on 2007-01-30 02:17
(Received via mailing list)
On 1/29/07, James <removed_email_address@domain.invalid> wrote:
>
> Is it possible to stack :include's in a situation like this:
>
> A has_many Bs
>
> B belongs_to A
> B has_many Cs
>
> C belongs_to B

Something like...

:include => { :bs => { :a => [], :cs => [:b]} }

http://rails.rubyonrails.org/classes/ActiveRecord/...
"Eager loading of associations" and "Table Aliasing"

--
Rick O.
http://weblog.techno-weenie.net
http://mephistoblog.com
Bill W. (Guest)
on 2007-01-30 03:14
(Received via mailing list)
Hi James,

James wrote:

> Is it possible to stack :include's in a situation like this:

Stack?

> The result of the query looking something like...

Looks like?  Is supposed to look like?  I wish it looked like?
James (Guest)
on 2007-01-30 17:17
Thanks Rick, that solved my problem.

Bill, if you have nothing nice to say, please say nothing.
This topic is locked and can not be replied to.