Re: acts_as_tree

Ilan Berci
Wed, 05 Aug 2009 14:51:48 -0000

Doug Jolley wrote:
> My goal is to use nested elements to display a hierarchical view
> of an entire table.  It is my understanding that all acts_as_tree does
> is make available 3 additional methods: ''ancestors'',
''root'', and
> ''siblings''.  As useful as these methods may be, I
don''t see how they
> are going to help me achieve my goal.  It seems to me that I''m
> additionally going to need to somehow get the table sorted properly;
> and, even after I have done that I''m still left with the difficult
> issue of keeping track of levels and opening and closing tags
> appropriately.  Am I missing something?
>
> Thanks for any input.
>
>           ... doug

Doug,

use siblings() to iterate through the node''s children and put a
for
each, if the child itself has children then wash and repeat.. think
helper functions and recursion..

ilan