diff --git a/README.md b/README.md index 16a86ba..89c7d05 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,8 @@ Note that closure_tree only supports ActiveRecord 7.2 and later, and has test co Make sure you check out the [large number of options](#available-options) that `has_closure_tree` accepts. + **Note:** The `acts_as_tree` alias is only created if your model doesn't already have a method with that name. This prevents conflicts with other gems like the original `acts_as_tree` gem. + **IMPORTANT: Make sure you add `has_closure_tree` _after_ `attr_accessible` and `self.table_name =` lines in your model.** @@ -156,10 +158,10 @@ Then: ```ruby grandparent.self_and_descendants.collect(&:name) -=> ["Grandparent", "Parent", "First Child", "Second Child", "Third Child", "Fourth Child"] +#=> ["Grandparent", "Parent", "First Child", "Second Child", "Third Child", "Fourth Child"] child1.ancestry_path -=> ["Grandparent", "Parent", "First Child"] +#=> ["Grandparent", "Parent", "First Child"] ``` ### find_or_create_by_path @@ -204,19 +206,16 @@ d = Tag.find_or_create_by_path %w[a b c d] h = Tag.find_or_create_by_path %w[e f g h] e = h.root d.add_child(e) # "d.children << e" would work too, of course -h.ancestry_path -=> ["a", "b", "c", "d", "e", "f", "g", "h"] +h.ancestry_path #=> ["a", "b", "c", "d", "e", "f", "g", "h"] ``` When it is more convenient to simply change the `parent_id` of a node directly (for example, when dealing with a form `