views:

310

answers:

1

I have model called test, and test can have many tests, and should be able to have a reference to it's parent test if it exists. EG

  • test <-- parent doesn't exist
    • test
      • test
      • test
        • test
      • test
    • test
  • test <-- parent doesn't exist

i've seen a couple of possible solutions with examples before 2.3, but how models handle references seems to have changed a lot since 2.0. I was wondering if anyone has a best route option for doing this with some 2.3 spiffiness. Any suggestions?

+3  A: 

If each test can have one parent and many children, this seems like an ideal use for acts_as_tree or acts_as_nested_set.

Jordan