aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/acts/tree.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-10-26 13:05:48 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-10-26 13:05:48 +0000
commita8eea0b04b2989bd054d7c852d636f1cc5494957 (patch)
treebff2ddce73b205a28bdfe048d74b669b92b20671 /activerecord/lib/active_record/acts/tree.rb
parent475bd74168a611cf0aeeda42d464aff1b3dfa806 (diff)
downloadrails-a8eea0b04b2989bd054d7c852d636f1cc5494957.tar.gz
rails-a8eea0b04b2989bd054d7c852d636f1cc5494957.tar.bz2
rails-a8eea0b04b2989bd054d7c852d636f1cc5494957.zip
Fix docs (closes #2491)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2744 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/acts/tree.rb')
-rw-r--r--activerecord/lib/active_record/acts/tree.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/acts/tree.rb b/activerecord/lib/active_record/acts/tree.rb
index 9cf5c3f732..1c7646b74c 100644
--- a/activerecord/lib/active_record/acts/tree.rb
+++ b/activerecord/lib/active_record/acts/tree.rb
@@ -6,8 +6,8 @@ module ActiveRecord
base.extend(ClassMethods)
end
- # Specify this act if you want to model a tree structure by providing a parent association and an children
- # association. This act assumes that requires that you have a foreign key column, which by default is called parent_id.
+ # Specify this act if you want to model a tree structure by providing a parent association and a children
+ # association. This act requires that you have a foreign key column, which by default is called parent_id.
#
# class Category < ActiveRecord::Base
# acts_as_tree :order => "name"
@@ -30,13 +30,14 @@ module ActiveRecord
#
# In addition to the parent and children associations, the following instance methods are added to the class
# after specifying the act:
- # * siblings: Return all the children of the parent excluding the current node ([ subchild2 ] when called from subchild1)
- # * ancestors: Returns all the ancestors of the current node ([child1, root] when called from subchild2)
- # * root: Returns the root of the current node (root when called from subchild2)
+ # * siblings : Returns all the children of the parent, excluding the current node ([ subchild2 ] when called from subchild1)
+ # * self_and_siblings : Returns all the children of the parent, including the current node ([ subchild1, subchild2 ] when called from subchild1)
+ # * ancestors : Returns all the ancestors of the current node ([child1, root] when called from subchild2)
+ # * root : Returns the root of the current node (root when called from subchild2)
module ClassMethods
# Configuration options are:
#
- # * <tt>foreign_key</tt> - specifies the column name to use for track of the tree (default: parent_id)
+ # * <tt>foreign_key</tt> - specifies the column name to use for tracking of the tree (default: parent_id)
# * <tt>order</tt> - makes it possible to sort the children according to this SQL snippet.
# * <tt>counter_cache</tt> - keeps a count in a children_count column if set to true (default: false).
def acts_as_tree(options = {})