Method: Katalyst::Content::Version#items
- Defined in:
- app/models/concerns/katalyst/content/version.rb
#items ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/models/concerns/katalyst/content/version.rb', line 24 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| items[node.id]&.tap do |item| item.index = node.index item.depth = node.depth end end end |