Skip to content

Instantly share code, notes, and snippets.

@jdkealy
Created October 2, 2011 16:16
Show Gist options
  • Save jdkealy/1257591 to your computer and use it in GitHub Desktop.
Save jdkealy/1257591 to your computer and use it in GitHub Desktop.
def all_children(x=1)
all = []
self.children.each do |f|
all << f
root_children = f.all_children(x).flatten
all << root_children unless root_children.empty?
end
return all.flatten
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment