Displaying 2 results from an estimated 2 matches for "find_all_subcategories".
2005 May 17
8
acts_as_tree elegant tree printing
...g with acts_as_tree to print an unordered list of items:
   Root
    -- Child
    ---- Child
I''ve got this working, however I''d like to know if there is a more  
elegant fashion that I''m unaware of:
   #Takes a parent category and recursivley returns all children
   def find_all_subcategories(category)
     if category.children.size > 0
       ret = "<ul>"
       category.children.each { |subcat|
         if subcat.children.size > 0
           ret += "<li>" + subcat.title
           ret += find_all_subcategories(subcat)
           ret += "</...
2006 Jul 20
3
acts_as_tree
...t of categories, I tried a lot of things, like (in the
view):
---------------------------------------------------------
<ul>
<% for category in @categories %>
    <li><%= link_to h(category.title), :action => ''edit'', :id => category %>
        <%= find_all_subcategories(category) %>
   </li>
<% end %>
</ul>
----------------------------------------------------------
But I ALWAYS and whatever I try I got this error message:
"You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error o...