Skip to content

Example: turning a nested set into a html list ( ol or ul )

amishyn edited this page Jul 16, 2012 · 6 revisions

You can try to do this with MIN view partials of this gem: https://github.com/the-teacher/the_sortable_tree

There is a much simpler approach: (see lib/nested_set/helper.rb)

arranged_nodes = Category.arrange

<%= render_tree arranged_nodes do |node, child| %>
  <li><%= node.name %>
  <%= child %></li>
<% end %>