Class: PandaCms::Menu

Inherits:
ApplicationRecord show all
Defined in:
app/models/panda_cms/menu.rb

Instance Method Summary collapse

Instance Method Details

#generate_auto_menu_itemsObject



16
17
18
19
20
21
22
23
24
25
# File 'app/models/panda_cms/menu.rb', line 16

def generate_auto_menu_items
  return false if kind != "auto"

  # NB: Transactions are not distributed across database connections
  transaction do
    menu_items.destroy_all
    menu_item_root = menu_items.create(text: start_page.title, panda_cms_page_id: start_page.id)
    generate_menu_items(parent_menu_item: menu_item_root, parent_page: start_page)
  end
end