Ok so i have this loop
def page_children(page)
content_tag :li do
link_to page.url, "/#{page.url_path}/#{page.url}"
if page.children.any?
content_tag :ul do
page_children(page)
end
end
end
end
And I keep getting stack level too deep
I am using this gem for my tree structure and my model and haml is the following
class Page < ActiveRecord::Base
acts_as_tree :order => 'sort_order'
belongs_to :parent, :class_name => "Page"
scope :parent_nav, lambda{ |navigation| where(:parent_id => nil, :is_home => 0, :nav => navigation).order("sort_order") }
end
My haml is the following
%ul
- Page.parent_nav("Attend").each do |page|
= page_children(page)
Basically i want a li for each page and if the page has children then i want another ul with an li for all the children...ext....but my loop is off somehow...any ideas on what im doing wrong