Hi all,
I have 2 very basic questions:
-
I have tree structures in my table and currently use
Node.find_all_by_parent_id(nil). but this returns all the trees with
parent_id == nil. Since I have more than 1 tree structure I want
something like Node.find_all_by_id(id) . Is this function available?
-
Is there a function available that deletes an entire branch?
The answers are probably easily available in the mannuals but I haven’t
found them. Maybe someone can point me out where they get this info
from.
Thanks in advance
Stijn
Hi,
Le 24 janv. 07, à 16:43, Tarscher a écrit :
- I have tree structures in my table and currently use
Node.find_all_by_parent_id(nil). but this returns all the trees with
parent_id == nil. Since I have more than 1 tree structure I want
something like Node.find_all_by_id(id) . Is this function available?
Maybe use :scope to differentiate your trees.
- Is there a function available that deletes an entire branch?
In Nested Sets, yes. With acts_as_tree I’m afraid you’ll have to
recurse.
Jean-Christophe M.
Better Nested Set for rails:
http://opensource.symetrie.com/trac/better_nested_set