Guest User

Untitled

a guest
Jan 19th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.40 KB | None | 0 0
  1. <% parents = [] %>
  2. <ul>
  3.     <% @categories.each do |category| %>
  4.         <% parents.each do |parent| %>
  5.       <% if !category.is_descendant_of?(parent) %>
  6.         <% active_parents.delete(parent) %>
  7.         </ul></li>
  8.       <% end %>
  9.     <% end %>
  10.         <li>
  11.         <%= category.name %>
  12.         <% if category.leaf? %>
  13.         </li>
  14.     <% else %>
  15.       <% parents << category %>
  16.       <ul>
  17.     <% end %>
  18.     <% end %>
  19. </ul>
Add Comment
Please, Sign In to add comment