[Rails] Using :include "recursively" (including the children of the child)?

Iván Vega Rivera ivanvega at gmail.com
Fri Dec 16 20:39:56 GMT 2005


Marcel Molina Jr. wrote:
> On Fri, Dec 16, 2005 at 02:14:57PM -0600, Iv?n Vega Rivera wrote:
>   
>> Is there any way I can load all Phone records at once? I wouldn't mind 
>> using custom SQL if that's the only solution.
>>     
>
> There is no way to do that using the eager loading implementation. It would
> require custom SQL.
>
> marcel
>   
Would it be possible to load the phones for the object:

@locs = Location.find(...someparms..., :include => [:schools, :group])

and then something like:

@locs.schools.phones.load_all (of course this method doesn't exist, but 
is there something similar?)

Or could I "find" all the phones that belong to certain schools and then 
assign those to the specific @locs.schools object?

Thanks!

Ivan V.



More information about the Rails mailing list