# Nested resources and hierarchical trees

**URL:** <https://www.ruby-forum.com/t/nested-resources-and-hierarchical-trees/110708>\
**Category:** Rails\
**Created:** [July 30, 2007, 1:29am UTC](https://www.ruby-forum.com/t/nested-resources-and-hierarchical-trees/110708 "2007-07-30T01:29:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phrosenkranz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/dc4da7/32.png) [@phrosenkranz](https://www.ruby-forum.com/u/phrosenkranz)\
**Post date:** [July 30, 2007, 1:29am UTC](https://www.ruby-forum.com/t/nested-resources-and-hierarchical-trees/110708/1 "2007-07-30T01:29:22Z")

</div>

Hi

I’ve started a project recently and decided to use the rest capabilities  
of  
rails.  
I generated a few resources with scaffold\_resource and did some nesting:

map.resources :roots do |roots|  
roots.resources :children do |children|  
children.resources :subchildren do |subchildren|  
subchildren.resources :subsubchildren  
end  
end  
end

( I’ve changed the names of the resources in this post for the sake of  
simplicity 😉 )

Now i want to have a overview page which shows ALL resources  
hierarchical starting with the root resource (like act\_as\_tree or  
act\_as\_nested\_set ).  
How can i do that?

BTW: the relationships are as follows:  
root has\_many children  
children belongs\_to root AND has\_many subchildren  
subchildren belongs\_to children AND has\_many subsubchildren
