Guest User

Untitled

a guest
Jun 22nd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. ## Controller #####
  2. def index
  3. @categories = Category.find(:all, :conditions => {:parent_id => nil})
  4. end
  5.  
  6. ## View #####
  7. #categories
  8. %h1 Categories
  9. %table
  10. - @categories.each do |c|
  11. %tr
  12. %th
  13. = link_to c.name, c
  14. %td.inverted
  15. - c.children.each do |child|
  16. %li= link_to (child.name, child)
  17. - child.children.each do |child2|
  18. %i.small= '// ' + child2.name
Add Comment
Please, Sign In to add comment