summaryrefslogtreecommitdiffstats
path: root/vendor
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-07-26 12:54:54 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-07-26 12:54:54 +0000
commitec7d1359301b28a506d3c9e9ad5785cf84d3fcd9 (patch)
tree3ebc58910568791073a3e955b996c8fd5313e193 /vendor
parent60d066f943c68a348fee3a8350dc5ba88878b69c (diff)
downloadredmine-ec7d1359301b28a506d3c9e9ad5785cf84d3fcd9.tar.gz
redmine-ec7d1359301b28a506d3c9e9ad5785cf84d3fcd9.zip
Adds child_pages macro for wiki pages (#528).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1699 e93f8b46-1217-0410-a6f0-8f06a7374b81
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