Module Ancestry::ClassMethods
In: lib/ancestry/class_methods.rb

Methods

Constants

ANCESTRY_UNCAST_TYPES = [:string, :uuid, :text].freeze

Public Instance methods

Get all nodes and sorting them into an empty hash

Arrange array of nodes into a nested hash of the form {node => children}, where children = {} if the node has no children If a node‘s parent is not included, the node will be included as if it is a top level node

Build ancestry from parent id‘s for migration purposes

Rebuild depth cache if it got corrupted or if depth caching was just turned on

Integrity restoration

Scope on relative depth options

Pseudo-preordered array of nodes. Children will always follow parents, for ordering nodes within a rank provide block, eg. Node.sort_by_ancestry(Node.all) {|a, b| a.rank <=> b.rank}.

Fetch tree node if necessary

[Validate]