diff --git a/README.md b/README.md index 05ddab31..b51ab6f9 100644 --- a/README.md +++ b/README.md @@ -145,11 +145,17 @@ child3 = Tag.new(name: 'Third Child') parent.add_child child3 ``` +Or by setting the parent on the child : + +```ruby +Tag.create(name: 'Fourth Child', parent: parent) +``` + Then: ```ruby grandparent.self_and_descendants.collect(&:name) -=> ["Grandparent", "Parent", "First Child", "Second Child", "Third Child"] +=> ["Grandparent", "Parent", "First Child", "Second Child", "Third Child", "Fourth Child"] child1.ancestry_path => ["Grandparent", "Parent", "First Child"]