Using acts_as_list, acts_as_tree, and STI in one model

Check it out y’all:
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?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs