Skip to content
Permalink
Browse files

readme list formatting

  • Loading branch information...
dhoss committed Oct 9, 2014
1 parent 75036b5 commit a250b5b0a6a00dcbb3fa75c6d35d53feedf6d78a
Showing with 4 additions and 10 deletions.
  1. +4 −10 README.md
@@ -9,8 +9,7 @@ treeify
Synopsis
========

1. Create your migration

1. Create your migration
```
create_table :nodes do |t|
t.text :name
@@ -20,8 +19,7 @@ Synopsis
add_index :nodes, [:parent_id, :id], :unique => true
```

2. Create your model

2. Create your model
```
class Node < ActiveRecord::Base
include Treeify
@@ -31,19 +29,15 @@ class Node < ActiveRecord::Base
validates_uniqueness_of :parent_id, :scope=> :id
end
```

3. Create a tree of stuff

3. Create a tree of stuff
```
parent = Node.create(name: "parent node")
child = parent.children.create(name: "child 1")
child2 = child.children.create(name: "child 2")
```

4. Retrieve tree of stuff

4. Retrieve tree of stuff
```
parent.descendent_tree
```

0 comments on commit a250b5b

Please sign in to comment.
You can’t perform that action at this time.