title: rails awesome nested set show all cats, sub cats, and sub sub cats
body: <p>I saw this post</p>
  
  <p><a href="https://stackoverflow.com/questions/2059920/ruby-on-rails-awesome-nested-set-plugin">Ruby on Rails - Awesome nested set plugin</a></p>
  
  <p>but I am wondering how to do the same thing without using node? I am also wondering what exactly this node is doing in the code itself.</p>
  
  <p>In my categories view folder i have _category.html.erb and a _full_categores_list.html.erb. </p>
  
  <p>The _category.html.erb has the following code which is the sae way as the link above.</p>
  
  <pre><code>&lt;li&gt;
    &lt;%= category.name %&gt;
  
   &lt;% unless category.children.empty? %&gt;
     &lt;ul&gt;
        &lt;%= render category.children %&gt;
     &lt;/ul&gt;
   &lt;% end %&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>The _full_categories_list.html.erb has the following code. </p>
  
  <pre><code>&lt;ul&gt;
    &lt;% YourModel.roots.each do |node| %&gt;
      &lt;%= render node %&gt;
    &lt;% end %&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>This code works perfectly fine. However, lets say hypothetically that I wanted to create duplicates of these files so instead of _full_categories_list.html.erb I was maybe making a _half_categories_list.html.erb which might do something a little different with the code. </p>
  
  <p>If I use similar code like what i used above in the _full_categories_list.html.erb it will keep calling the _category.html.erb.</p>
  
  <p>How can I show all the cats, sub cats, and sub sub cats by using _half_categories_list.html.erb and a file like _half_category.html.erb instead of _category.html.erb</p>
  
  <p>The half category and full category are just names to indicate that I am doing something different in each file. I hope this makes sense. I want to basically duplicate the functionality of the code from the link above but use _half_category.html.erb instead of _category.html.erb because I'm trying to put different functionality in the _half_category.html.erb file.</p>