Re: acts_as_tree

Marnen Laibow-Koser
Wed, 05 Aug 2009 16:24:13 -0000

Ilan Berci wrote:
[...]
>
> 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..

That''s pretty inefficient on a tree of any size, at least if
you''re
doing a DB query each time instead of loading the whole tree into
memory.

Instead, use awesome_nested_set or similar.  It provides a data
structure much better suited to what you want.

>
> ilan

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org