Best way to implement Categories and Subcategories with flexible depth in Rails?

Posted by benoror on Stack Overflow See other posts from Stack Overflow or by benoror
Published on 2010-04-20T15:32:51Z Indexed on 2010/04/20 15:43 UTC
Read the original article Hit count: 468

Hi. I have a Category and Subcategoy models in my project. I would like to have many sub-levels in a flexible way. I thought making a self referential "parent" foreign key but I'm not quite sure how to do it. Any ideas? Thanks!

Cat1
    Sub1
        SubSub1
        SubSub2
    Sub2
Cat2
    Sub1
Cat3
    Sub1
    Sub2
        SubSub1

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby