I have a method as shown:
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