I''ve added a method in my Forum model code just for this:
   def descendants
     children.map { |f| !f.children.empty? ? f.children + [f]:  
f }.flatten
   end
   def self.find_all_without_parent
     find_all_by_parent_id(nil)
   end
It finds all the descendants of a given forum, you could just cycle  
through all top-level forums using the Forum.find_all_without_parent  
method and just query about the descendants of each item. I believe my  
solution will give you a flat version of them however.
On 31/07/2008, at 1:41 PM, Joshua Abbott wrote:
>
> I''m using acts_as_tree to nest categories n-levels deep and am  
> wondering
> if anyone out there in Ruby-land knows the best, least expensive way  
> to
> start with top level categories and then loop recursively through each
> category going as many levels deep as needed, and then moving to the
> next top level category, etc.
>
> Thanks,
> Josh
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---