Skip to content
Browse files

Updated README

  • Loading branch information...
1 parent 95e6701 commit ce731efde78a090f220a0e9ea8e9e4a76a797e7f @stefankroes committed Oct 18, 2009
Showing with 30 additions and 30 deletions.
  1. +30 −30 README.rdoc
View
60 README.rdoc
@@ -39,26 +39,26 @@ You can also create children through the children relation on a node:
To navigate an Ancestry model, use the following methods on any instance / record:
- *parent* Returns the parent of the record
- *root* Returns the root of the tree the record is in
- *root_id* Returns the id of the root of the tree the record is in
- *is_root?* Returns true if the record is a root node, false otherwise
- *ancestor_ids* Returns a list of ancestor ids, starting with the root id and ending with the parent id
- *ancestors* Scopes the model on ancestors of the record
- *path_ids* Returns a list the path ids, starting with the root is and ending with the node's own id
- *path* Scopes model on path records of the record
- *children* Scopes the model on children of the record
- *child_ids* Returns a list of child ids
- *has_children?* Returns true if the record has any children, false otherwise
- *is_childless?* Returns true is the record has no childen, false otherwise
- *siblings* Scopes the model on siblings of the record, the record itself is included
- *sibling_ids* Returns a list of sibling ids
- *has_siblings?* Returns true if the record's parent has more than one child
- *is_only_child?* Returns true if the record is the only child of its parent
- *descendants* Scopes the model on direct and indirect children of the record
- *descendant_ids* Returns a list of a descendant ids
- *subtree* Scopes the model on descendants and itself
- *subtree_ids* Returns a list of all ids in the record's subtree
+ parent Returns the parent of the record
+ root Returns the root of the tree the record is in
+ root_id Returns the id of the root of the tree the record is in
+ is_root? Returns true if the record is a root node, false otherwise
+ ancestor_ids Returns a list of ancestor ids, starting with the root id and ending with the parent id
+ ancestors Scopes the model on ancestors of the record
+ path_ids Returns a list the path ids, starting with the root is and ending with the node's own id
+ path Scopes model on path records of the record
+ children Scopes the model on children of the record
+ child_ids Returns a list of child ids
+ has_children? Returns true if the record has any children, false otherwise
+ is_childless? Returns true is the record has no childen, false otherwise
+ siblings Scopes the model on siblings of the record, the record itself is included
+ sibling_ids Returns a list of sibling ids
+ has_siblings? Returns true if the record's parent has more than one child
+ is_only_child? Returns true if the record is the only child of its parent
+ descendants Scopes the model on direct and indirect children of the record
+ descendant_ids Returns a list of a descendant ids
+ subtree Scopes the model on descendants and itself
+ subtree_ids Returns a list of all ids in the record's subtree
= (Named) Scopes
@@ -70,11 +70,11 @@ Where possible, the navigation methods return scopes instead of records, this me
For convenience, a couple of named scopes are included at the class level:
- *roots* Only root nodes
- *ancestors_of(node)* Only ancestors of node, node can be either a record or an id
- *children_of(node)* Only children of node, node can be either a record or an id
- *descendants_of(node)* Only descendants of node, node can be either a record or an id
- *siblings_of(node)* Only siblings of node, node can be either a record or an id
+ roots Only root nodes
+ ancestors_of(node) Only ancestors of node, node can be either a record or an id
+ children_of(node) Only children of node, node can be either a record or an id
+ descendants_of(node) Only descendants of node, node can be either a record or an id
+ siblings_of(node) Only siblings of node, node can be either a record or an id
Thanks to some convenient rails magic, it is even possible to create nodes through the children and siblings scopes:
@@ -87,11 +87,11 @@ Thanks to some convenient rails magic, it is even possible to create nodes throu
The acts_as_tree methods supports two options:
- *ancestry_column* Pass in a symbol to instruct Ancestry to use a different column name to store record ancestry
- *orphan_strategy* Instruct Ancestry what to do with children of a node that is destroyed:
- *:destroy* All children are destroyed as well (default)
- *:rootify* The children of the destroyed node become root nodes
- *:restrict* An AncestryException is raised if any children exist
+ ancestry_column Pass in a symbol to instruct Ancestry to use a different column name to store record ancestry
+ orphan_strategy Instruct Ancestry what to do with children of a node that is destroyed:
+ :destroy All children are destroyed as well (default)
+ :rootify The children of the destroyed node become root nodes
+ :restrict An AncestryException is raised if any children exist
= Arrangement

0 comments on commit ce731ef

Please sign in to comment.
Something went wrong with that request. Please try again.