[Rails] Using :include "recursively" (including the children of the
child)?
Iván Vega Rivera
ivanvega at gmail.com
Fri Dec 16 20:14:57 GMT 2005
Hi,
Let's say I have the following hierarchy of tables:
Group <- parent
Location <- child of Group
School <- child of Location
Phone <- child of School
Then, if I want to do this:
Location.find(...someparms..., :include => [:schools, :group, :phones])
I get an association error (Association was not found). I guess it
happens because AR is looking in the Location model for the Phones
association, which only exists in the School model (I also tried
singular, :phone).
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.
Thanks in advance!
Ivan V.
PS: Merrrrry christmas!
More information about the Rails
mailing list