# Eager loading with acts\_as\_tree

**URL:** <https://www.ruby-forum.com/t/eager-loading-with-acts-as-tree/125251>\
**Category:** Rails\
**Created:** [January 7, 2008, 2:56pm UTC](https://www.ruby-forum.com/t/eager-loading-with-acts-as-tree/125251 "2008-01-07T14:56:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tarscher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8491ac/32.png) [@Tarscher](https://www.ruby-forum.com/u/Tarscher)\
**Post date:** [January 7, 2008, 2:56pm UTC](https://www.ruby-forum.com/t/eager-loading-with-acts-as-tree/125251/1 "2008-01-07T14:56:33Z")

</div>

Hi all,

I have a group, user and registration model all connected to each  
other.

the group has a acts\_as\_tree property.

I get the groups I want via  
top = Group.find\_by\_parent\_id(nil)  
groups = top.children()

I need to iterate over this groups record like:  
groups.first.users.first.registration

the problem is that this is very bad performnce wise. I assume I can’t  
include the user and registration in the children() method? Can I do  
it somewhere else?

regards,  
Stijn
