我有一個方法,如下所示:如何在軌遞歸函數,將返回父母的孩子,和所有兒童的兒童等等.... TO N-水平
def all_pages_and_its_n_level_child
@parent_pages = Page.where(:parent_id => params[:page_id])
#this will give me all child of this page
for page in @parent_pages
child_exists=Page.where(:parent_id=>page.id)
#this will give all children of that page
#*I want to make this loop further so that i can check to N-levels,
#this is only for two levels*
end
end