Hello,
I saw this post
http://stackoverflow.com/questions/2059920/ruby-on-rails-awesome-nested-set-plugin
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.
In my categories view folder i have _category.html.erb and a _full_categores_list.html.erb.
The _category.html.erb has the following code which is the sae way as the link above.
<li>
<%= category.name %>
<% unless category.children.empty? %>
<ul>
<%= render category.children %>
</ul>
<% end %>
</li>
The _full_categories_list.html.erb has the following code.
<ul>
<% YourModel.roots.each do |node| %>
<%= render node %>
<% end %>
</ul>
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.
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.
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
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.