Nested sets, threads, trees..

I’ve been implementing CD review site. There is a two tiered category System (i.e. Jazz > Hard Bop). Reviews can only be added in a sub-category (i.e. Hard Bop). Write now I have this implemented in an adjacency list schema with sub categories having parent_id and reviews having category_id. \

IE.

  • Jazz
    • Hard Bop
      • Review: foo
      • Review : foo2
      • Review: foo3
    • Free
      • Review: fooa
      • Review : foob
      • Review: fooc
    • Fusion

The problem is, I want to be able to do something like this:

Find a top level category

@cat = Category.find_by_name(“Jazz”)

#Get a collection of all the reviews associated with the sub-categories of a toplevel

@all_reviews = @cat.reviews

In this case @all_reviews would have 6 objects in its collection.

Thanks for any help.

  • Nathan