From ec7d1359301b28a506d3c9e9ad5785cf84d3fcd9 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 26 Jul 2008 12:54:54 +0000 Subject: Adds child_pages macro for wiki pages (#528). git-svn-id: http://redmine.rubyforge.org/svn/trunk@1699 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'vendor') 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 -- cgit v1.2.3