Please excuse my question as I’m sure it’s been answered, but I can’t
find it anywhere.
I have a table of categories:
id name
1 Foo
2 Bar
I have things which belong_to categories:
id category_id subject date
1 1 my subject 07/09/2004
and Further classifications which belong_to categories:
id category_id name
1 1 More Foo
2 1 Most Foo
3 2 Some Bar
and subcategories which belong_to categories, classifications, and
things
id category_id classification_id thing_id
1 1 1 some item
2 1 2 another item
I want my index to contain links to those categories:
Foo
Bar
By clicking on Foo, I’d like it to display things belonging to Foo, and
expand to show classifications
Foo
More Foo (Foo Stuff)
Most Foo
Bar
It seems like I should be able to do this without having to create a
controller for each Foo, Bar, etc Category, but I can’t figure out how.
If the standard index page shows categories, it seems as if I’m simply
adding a filter now to say “ok, get categories, but only if they are of
type X”.
Again, sorry if this is a stupid question. Thanks for any help you can
provide.
I suppose I partially figured this out… I added the method to the
controller for that category name. I suppose I could use a
method_missing type of thing to make this a little more dynamic, or is
that a bad idea?
Of course, now it complains about missing the view… what would I do
for that?