summaryrefslogtreecommitdiffstats
path: root/vendor
diff options
context:
space:
mode:
Diffstat (limited to 'vendor')
-rw-r--r--vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb b/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb
index 1f00e90a9..6a6827ee6 100644
--- a/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb
+++ b/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb
@@ -70,6 +70,13 @@ module ActiveRecord
nodes
end
+ # Returns list of descendants.
+ #
+ # root.descendants # => [child1, subchild1, subchild2]
+ def descendants
+ children + children.collect(&:children).flatten
+ end
+
# Returns the root node of the tree.
def root
node = self