Parent.find(parent.id).to_xml(:include => [children, grandchildren] = Help?

I've read Fred Cheung's excellent example of nested :includes at the link;

His examples deal with including parent and children associations but I can't see the connection of how to address a child, grandchild nested :include.

I am presenting my users' with the ability to create a complex find upon the Parent table. The result of this find ( @parent ) will then be passed to another find whose purpose is to create a multilevel 'nested' array that is then passed to the .to_xml method.

I am pursuing this approach in order to pass the resultant @xmlout array to the Jasper Reports ( iReport ) framework is which the user is able to generate some very robust reports.

Obviously, one might suggest this approach;

for parent in @parents   @xmlout << parent   for child in parent.child     @xmlout << child     for grandchild in child.grandchildren       @xmlout << grandchild

When this @xmlout is created the indention of the resulting XML file has the child and grandchild at equal levels in XML indentation as the parent. The only way I seem to be able to get a properly indented XML file that makes sense to the Jasper Reports framework is to call the .to_xml method against a 'ActiveRecord' prepared nested array. The following attempts don't 'Blow Up' but yield the child and NOT the grandchild nested array. These are;

@xmlout << Parent.find(parent.id).to_xml(:include => {:children => {:child => :grandchildren}}) @xmlout << Parent.find(parent.id).to_xml(:include => {:children => {:grandchildren => :child}})

I am happy to share any parts of this endeavor which is loosely predicated upon the excellent "How to Integrate Jasper Reports" at http://wiki.rubyonrails.org/rails/pages/howtointegratejasperreports

Thank you, David