I have a model using acts_as_tree which is working fine. Being new to Ruby I''m don''t know what enumerator is best to use for traversing a tree by depth. I can write one, but before I do I wanted to know if there is there an enumerator for traversing trees available that the community recommends? Thank you, Jose -- Posted via http://www.ruby-forum.com/.
Jose Hales-Garcia wrote:> I have a model using acts_as_tree which is working fine. > > Being new to Ruby I''m don''t know what enumerator is best to use for > traversing a tree by depth. I can write one, but before I do I wanted > to know if there is there an enumerator for traversing trees available > that the community recommends?I don''t know if it contains an enumerator, but acts_as_nested_set is more efficient than acts_as_tree if you need to do this kind of iteration more often. -- Posted via http://www.ruby-forum.com/.
Andreas S. wrote:> I don''t know if it contains an enumerator, but acts_as_nested_set is > more efficient than acts_as_tree if you need to do this kind of > iteration more often.It looks as if acts_as_nested_set is exactly what I am looking for. Thank you for the suggestion. Jose -- Posted via http://www.ruby-forum.com/.
On 2/25/06, Jose Hales-Garcia <jose@stat.ucla.edu> wrote:> Andreas S. wrote: > > I don''t know if it contains an enumerator, but acts_as_nested_set is > > more efficient than acts_as_tree if you need to do this kind of > > iteration more often. > > It looks as if acts_as_nested_set is exactly what I am looking for. > Thank you for the suggestion.You can also try the acts_as_threaded plugin: http://www.railtie.net/articles/2006/02/05/rails-acts_as_threaded-plugin -- Rick Olson http://techno-weenie.net