Methods
Public Instance methods
ancestors()

Returns list of ancestors, starting from parent until root.

  subchild1.ancestors # => [child1, root]
    # File vendor/rails/activerecord/lib/active_record/acts/tree.rb, line 68
68:         def ancestors
69:           node, nodes = self, []
70:           nodes << node = node.parent while node.parent
71:           nodes
72:         end
root()
    # File vendor/rails/activerecord/lib/active_record/acts/tree.rb, line 74
74:         def root
75:           node = self
76:           node = node.parent while node.parent
77:           node
78:         end
self_and_siblings()
    # File vendor/rails/activerecord/lib/active_record/acts/tree.rb, line 84
84:         def self_and_siblings
85:           parent ? parent.children : self.class.roots
86:         end
siblings()
    # File vendor/rails/activerecord/lib/active_record/acts/tree.rb, line 80
80:         def siblings
81:           self_and_siblings - [self]
82:         end