diff options
author | Michael Koziarski <michael@koziarski.com> | 2007-08-28 23:17:49 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2007-08-28 23:17:49 +0000 |
commit | 5972fd493b1c5537a1e7ef63e5beca3cf4de8fb9 (patch) | |
tree | 89af818c995dfe0d594e04aa69aa3f673eef2ff9 /activerecord/lib/active_record/acts/tree.rb | |
parent | 5840108b6e7f8b7af426d701eee8a8989368da07 (diff) | |
download | rails-5972fd493b1c5537a1e7ef63e5beca3cf4de8fb9.tar.gz rails-5972fd493b1c5537a1e7ef63e5beca3cf4de8fb9.tar.bz2 rails-5972fd493b1c5537a1e7ef63e5beca3cf4de8fb9.zip |
Formatting and grammatical fixes for the acts_as_* documentation [seanhussey, kampers] Closes #9107
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7366 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/acts/tree.rb')
-rw-r--r-- | activerecord/lib/active_record/acts/tree.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/activerecord/lib/active_record/acts/tree.rb b/activerecord/lib/active_record/acts/tree.rb index b92587e521..5e2e50552d 100644 --- a/activerecord/lib/active_record/acts/tree.rb +++ b/activerecord/lib/active_record/acts/tree.rb @@ -5,8 +5,8 @@ module ActiveRecord base.extend(ClassMethods) end - # 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. + # Specify this +acts_as+ extension if you want to model a tree structure by providing a parent association and a children + # association. This requires that you have a foreign key column, which by default is called +parent_id+. # # class Category < ActiveRecord::Base # acts_as_tree :order => "name" @@ -28,17 +28,17 @@ module ActiveRecord # root.children.first.children.first # => subchild1 # # In addition to the parent and children associations, the following instance methods are added to the class - # after specifying the act: - # * 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) + # after calling <tt>acts_as_tree</tt>: + # * <tt>siblings</tt> - Returns all the children of the parent, excluding the current node (<tt>[subchild2]</tt> when called on <tt>subchild1</tt>) + # * <tt>self_and_siblings</tt> - Returns all the children of the parent, including the current node (<tt>[subchild1, subchild2]</tt> when called on <tt>subchild1</tt>) + # * <tt>ancestors</tt> - Returns all the ancestors of the current node (<tt>[child1, root]</tt> when called on <tt>subchild2</tt>) + # * <tt>root</tt> - Returns the root of the current node (<tt>root</tt> when called on <tt>subchild2</tt>) module ClassMethods # Configuration options are: # - # * <tt>foreign_key</tt> - specifies the column name to use for tracking 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). + # * <tt>counter_cache</tt> - keeps a count in a +children_count+ column if set to +true+ (default: +false+). def acts_as_tree(options = {}) configuration = { :foreign_key => "parent_id", :order => nil, :counter_cache => nil } configuration.update(options) if options.is_a?(Hash) |