according to this answer https://stackoverflow.com/a/11335283/2397494 i'm trying to make tree menu for my appliction
this answer working only for root
and first children
.
I'm looking for suggestion to transform this code, work well with n
childrens.
<ul id="menu">
<% Hub.roots.each do |category| %>
<li> <%= link_to h(category.title), category %>
<% unless category.children.empty? %>
<ul id="sub-menu">
<% category.children.each do |subcategory| %>
<li><%= link_to h(subcategory.title), subcategory %></li>
<% end %>
</ul>
<% end %>
</li>
<% end %>
</ul>
partial
_sub
and css