我使用簡單的導航構建了導航菜單,並構建了嵌套的類別,我在此菜單中顯示。Rails簡單導航,嵌套集
navigation.rb代碼:
navigation.items do |primary|
Category.roots.map do |root|
primary.item ":root_#{root.id}", root.title, category_path(root) do |secondary|
root.descendants.map do |desc|
secondary.item ":desc_#{desc.id}", desc.title, category_path(desc)
end
end
end
end
的問題是:我怎麼能在我的菜單顯示類別中的所有級別。該代碼只用於兩層嵌套。
預先感謝