Getting a a list of acts_as_tree items with hierarchy

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

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.