Skip to content

Instantly share code, notes, and snippets.

@bishopandco
Created November 2, 2010 05:58
Show Gist options
  • Save bishopandco/659292 to your computer and use it in GitHub Desktop.
Save bishopandco/659292 to your computer and use it in GitHub Desktop.
def display_tree_navigation(tree, parent_id)
ret = "<ul>"
tree.each do |node|
if node.parent_id == parent_id
ret += "<li>"
ret += link_to node.title, node
ret += display_tree_navigation(node.children, node.id)
ret += "</li>"
end
end
ret += "</ul>"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment