lib/fertile_forest/modules/finders.rb
#
# Find root node from base node.
#
# @param base_obj [Entity|int] Base node|id to find.
# @param columns [Array] Columns for SELECT clause.
# @return [Entity] Root node. When base node is root, return base node.
# @return [Enil] No root node.
#
Find root node from base node.
Find root node from base node .
def root(base_obj, columns = nil)
            base_node = ff_resolve_nodes(base_obj)
            return nil if base_node.blank?
            return base_node if base_node.ff_depth == ROOT_DEPTH
            trunk_query = trunk(base_node, ANCESTOR_ONLY_ROOT, columns)
            return nil if trunk_query.blank?
            trunk_query.first
          end
def root ( base_obj , columns = nil ) base_node = ff_resolve_nodes ( base_obj ) return nil if base_node . blank? return base_node if base_node . ff_depth == ROOT_DEPTH trunk_query = trunk ( base_node , ANCESTOR_ONLY_ROOT , columns ) return nil if trunk_query . blank? trunk_query . first end
Find root node from base node.
Find root node from base node .
Root node. When base node is root, return base node.
Root node . When base node is root return base node .
Entity
No root node.
No root node .
Enil
base_obj
Base node|id to find.
Base node|id to find .
columns
Columns for SELECT clause.
Columns for SELECT clause .