I have a self-referencing table 'Properties' and I want to build a hierarchy of all properties starting at the lowest in the tree. What is the best approach to this is Rails?
for example:
"properties" table
id>name>belongs_to_id 1|item1|NULL 2|item 2|1 3|item 3|NULL 4|item 4|2
So how would I retrieve the related rows with ids 1,2,4 in such a way that I can easily build a tree-like list such as:
1 ...2 ......4
Thanks, Lee