Best way to implement flexible depth categories and subcategories in Rails?

My project has models for categories and subcategories. I would like many sub-levels to be flexible. I thought I was doing a stand-alone referential β€œparent” foreign key, but I'm not quite sure how to do this. Any ideas? Thanks!

Cat1 Sub1 SubSub1 SubSub2 Sub2 Cat2 Sub1 Cat3 Sub1 Sub2 SubSub1 
+6
ruby ruby-on-rails model-view-controller ruby-on-rails-plugins
source share
2 answers

Try acts_as_tree plugin

+5
source share

Awesome_nested_set is the best solution for these types of structures in rails. http://github.com/collectiveidea/awesome_nested_set

+5
source share

All Articles