app/helpers/tree_structure_helper.rb
def build_pages_tree
    # The hash_tree method returns a hash that for each node has a SitePage ...
    # ... as the key, and an array of hashes for values
    tree = Page.where(site_id: @site.id).select(:id, :name, :parent_id, :position, :enabled, :content_type, :show_on_menu).hash_tree

    return format_tree tree.keys.first, tree.values.first
  end
# Creates a closure tree for a site
Creates a closure tree for a site
Creates a closure tree for a site
def build_pages_tree
    tree = Page.where(site_id: @site.id).select(:id, :name, :parent_id, :position, :enabled, :content_type, :show_on_menu).hash_tree
    return format_tree tree.keys.first, tree.values.first
  end
def build_pages_tree tree = Page . where ( site_id : @site . id ) . select ( :id , :name , :parent_id , :position , :enabled , :content_type , :show_on_menu ) . hash_tree return format_tree tree . keys . first , tree . values . first end
Creates a closure tree for a site
Creates a closure tree for a site
# The hash_tree method returns a hash that for each node has a SitePage ... # ... as the key, and an array of hashes for values