Class: Katalyst::Navigation::Menu::Version
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- Katalyst::Navigation::Menu::Version
- Includes:
- HasTree
- Defined in:
- app/models/katalyst/navigation/menu.rb
Instance Method Summary collapse
Methods included from HasTree
Instance Method Details
#items ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'app/models/katalyst/navigation/menu.rb', line 107 def items # support building menus in memory # requires that items are added in order and index and depth are set return parent.items unless parent.persisted? items = parent.items.where(id: nodes.map(&:id)).index_by(&:id) nodes.map do |node| item = items[node.id] item.index = node.index item.depth = node.depth item end end |