plugins/identity/app/models/identity/project_tree.rb
# Wrapper for project and project's children
Wrapper for project and project's children
Wrapper for project and project ' s children
def build_tree
      @nodes.each do |project_id, node|
        next if project_id == ROOT
        if node.parent_id.nil?
          root.children << node
        else
          parent = find_by_id(node.parent_id) || root
          parent.children << node
        end
      end
    end
def build_tree @nodes . each do | project_id , node | next if project_id == ROOT if node . parent_id . nil? root . children << node else parent = find_by_id ( node . parent_id ) || root parent . children << node end end end
Wrapper for project and project's children
Wrapper for project and project ' s children
# ignore root node # if parent id is nil then add this node to root children # parent id is not nil # Try to find a node by parent id or use root. # It can happen that the parent is not included in projects. # In this case we use the root node as parent.