# Managing Hierarchical Data

**URL:** <https://www.ruby-forum.com/t/managing-hierarchical-data/122584>\
**Category:** Rails\
**Created:** [December 9, 2007, 9:10pm UTC](https://www.ruby-forum.com/t/managing-hierarchical-data/122584 "2007-12-09T21:10:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aliasxneo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/df705f/32.png) [@aliasxneo](https://www.ruby-forum.com/u/aliasxneo)\
**Post date:** [December 9, 2007, 9:10pm UTC](https://www.ruby-forum.com/t/managing-hierarchical-data/122584/1 "2007-12-09T21:10:58Z")

</div>

Hello,

I am in the process of trying to date hierarchical data in a MySQL  
database and convert it into a treeview view JS scripting. As a beginner  
to ROR there are still many unknown things to me, and handling this sort  
of data is one of them. My question is this: Is there any built in  
functionality for handling hierarchical data (via a MySQL DB) in  
Rails/Ruby? If there is can someone please explain it or link to  
documentation on it? That would be of great help, thanks.

- Josh

---

<div class="post-metadata">

**Author:** ![aliasxneo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/df705f/32.png) [@aliasxneo](https://www.ruby-forum.com/u/aliasxneo)\
**Post date:** [December 9, 2007, 10:48pm UTC](https://www.ruby-forum.com/t/managing-hierarchical-data/122584/2 "2007-12-09T22:48:15Z")

</div>

On Dec 9, 2007 3:10 PM, Josh G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> 

Models:  
acts\_as\_nested\_set  
acts\_as\_list  
acts\_as\_tree

> **[O'Reilly Media - Technology and Business Training](https://www.oreilly.com)**
>
> Gain technology and business knowledge and hone your skills with learning resources created and curated by O'Reilly's experts: live online training, video, books, our platform has content from 200+ of the world's best publishers.

Controllers:  
[http://pezra.barelyenough.org/blog/2007/07/hierarchical-resources-in-rails/](http://pezra.barelyenough.org/blog/2007/07/hierarchical-resources-in-rails/)

Do any of those help? You could also simply setup your models  
appropriately  
and use some type of parent\_id as a foreign key.

Regards,  
Michael G.

---

<div class="post-metadata">

**Author:** ![aliasxneo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/df705f/32.png) [@aliasxneo](https://www.ruby-forum.com/u/aliasxneo)\
**Post date:** [December 9, 2007, 11:20pm UTC](https://www.ruby-forum.com/t/managing-hierarchical-data/122584/3 "2007-12-09T23:20:38Z")

</div>

Michael G. wrote:

> On Dec 9, 2007 3:10 PM, Josh G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> wrote:
> 
> > 
> 
> Models:  
> acts\_as\_nested\_set  
> acts\_as\_list  
> acts\_as\_tree  
> [O'Reilly Media - Technology and Business Training](http://www.oreillynet.com/ruby/blog/2006/07/treemap_on_rails.html)
> 
> Controllers:  
> [http://pezra.barelyenough.org/blog/2007/07/hierarchical-resources-in-rails/](http://pezra.barelyenough.org/blog/2007/07/hierarchical-resources-in-rails/)
> 
> Do any of those help? You could also simply setup your models  
> appropriately  
> and use some type of parent\_id as a foreign key.
> 
> Regards,  
> Michael G.

Somewhat, though not really. Essentially what I am trying to build is a  
hierarchical subject list, like how you might navigate a site. For  
instance you select “Toys” and it drops down to list the sub-groups  
“electronic” and “mobile”. I was simply wondering if there were any  
tools to help organize this data so that creating such a list would be  
much more simpler as I lack the skills to hard code my own version into  
the model.
