# Using acts\_as\_list, acts\_as\_tree, and STI in one model

**URL:** <https://www.ruby-forum.com/t/using-acts-as-list-acts-as-tree-and-sti-in-one-model/127289>\
**Category:** Rails\
**Created:** [January 27, 2008, 9:22pm UTC](https://www.ruby-forum.com/t/using-acts-as-list-acts-as-tree-and-sti-in-one-model/127289 "2008-01-27T21:22:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/dbc845/32.png) [@marko](https://www.ruby-forum.com/u/marko)\
**Post date:** [January 27, 2008, 9:22pm UTC](https://www.ruby-forum.com/t/using-acts-as-list-acts-as-tree-and-sti-in-one-model/127289/1 "2008-01-27T21:22:18Z")

</div>

Check it out y’all:  
[http://rafb.net/p/NJg5U147.html](http://rafb.net/p/NJg5U147.html)  
(pastie was down)

I’m trying to make a tree which belongs\_to another model, where you can  
have sections or items as children, and sections can have sections or  
items as well. Moreover, any siblings should be sortable.

For instance:

Root

- Section 1
- 
  - Item A

- 
  - Item B

- Item C
- Section 2
- 
  - Item D

- 
  - Section 3

- 
  - 
    - Item E

- 
  - Item F

etc.

Those items are going to be “has\_one” with another model.

Right now I’m getting this error: NameError: undefined local variable or  
method `parent\_id’ but more generally, is there anything wrong with my  
approach?
