Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Controller #####
- def index
- @categories = Category.find(:all, :conditions => {:parent_id => nil})
- end
- ## View #####
- #categories
- %h1 Categories
- %table
- - @categories.each do |c|
- %tr
- %th
- = link_to c.name, c
- %td.inverted
- - c.children.each do |child|
- %li= link_to (child.name, child)
- - child.children.each do |child2|
- %i.small= '// ' + child2.name
Add Comment
Please, Sign In to add comment