| Module | SymetrieCom::Acts::NestedSet::InstanceMethods |
| In: |
lib/symetrie_com/acts_as_better_nested_set.rb
|
This module provides instance methods for an enhanced acts_as_nested_set mixin. Please see the README for background information, examples, and tips on usage.
Deprecated. Adds a child to this object in the tree. If this object hasn‘t been initialized, it gets set up as a root node.
This method exists only for compatibility and will be removed in future versions.
All nodes between two nodes, those nodes included in effect all ancestors until the other is reached
Checks the left/right indexes of the entire tree that this node belongs to, returning the number of records checked. Throws ActiveRecord::ActiveRecordError if it finds a problem. This method is needed because check_subtree alone cannot find gaps between virtual roots, orphaned nodes or endless loops.
Checks the left/right indexes of one node and all descendants. Throws ActiveRecord::ActiveRecordError if it finds a problem.
Returns the child for the requested id within the scope of its children, otherwise nil
Returns a child collection for the requested ids within the scope of its children, otherwise empty array
On destruction, delete all children and shift the lft/rgt values back to the left so the counts still work.
Returns the child for the requested id within the scope of its immediate children, otherwise nil
Returns a child collection for the requested ids within the scope of its immediate children, otherwise empty array
Returns itself and all nested children. Pass :exclude => item, or id, or [items or id] to exclude one or more items and all of their descendants.
Insert a node at a specific position among the children of target.
Moves a node one down amongst its siblings. Does nothing if it‘s already the last sibling.
Moves a node one up amongst its siblings. Does nothing if it‘s already the first sibling.
Moves a node one to be the last amongst its siblings. Does nothing if it‘s already the last sibling.
Make this node a child of target (you can pass an object or just an id). Unsaved changes in either object will be lost. Raises ActiveRecord::ActiveRecordError if it encounters a problem.
Move this node to the left of target (you can pass an object or just an id). Unsaved changes in either object will be lost. Raises ActiveRecord::ActiveRecordError if it encounters a problem.
Move this node to the right of target (you can pass an object or just an id). Unsaved changes in either object will be lost. Raises ActiveRecord::ActiveRecordError if it encounters a problem.
Moves a node one to be the first amongst its siblings. Does nothing if it‘s already the first sibling.
Returns all siblings to the right of self, in ascending order, so the first sibling is the one closest to the right of self
Returns all siblings to the left of self, in descending order, so the first sibling is the one closest to the left of self
Re-calculate the left/right values of all nodes in this record‘s tree. Can be used to convert an ordinary tree into a nested set.
All siblings until the other is reached - including self
Swaps the position of two sibling nodes preserving a sibling‘s descendants. The current implementation only works amongst siblings.
Calculate the least amount of swap steps to achieve the requested order