Why does my recursive method from helper not return every value?
问题 I want to display a tree of categories managed with the gem ancestry. I would like to use a helper which will recursively go through the tree and return the categories one by one, for the moment without html tags or content. module CategoriesHelper def display_tree(category) if category.has_children? category.children.each do |sub_category| display_tree(sub_category) puts(sub_category.name) # to check if it goes here end end category.name end end The category argument is one of the root