First off, hi, I'm [obviously] new :O) 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.
on 2005-12-20 04:58
on 2005-12-20 05:46
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?
on 2005-12-20 06:05
I came across that in the Agile Web D. book (...plug) Apparently, you can do a ruby script/generate controller Admin::Book action1 action2 ... to generate a Book controller and model within the Admin module. which you would reference as http://my.app/admin/book/edit/1234 You would reference class Admin::BookController < ApplicationController ,,, and class Content::BookController << ApplicationController The first BookController would be in app/controllers/admin, the second would be in app/controllers/content The template for the first would be in app/views/admin/book/edit.rhtml The template for the second would be in app/views/content/book/edit.rhtml Don't know if the scaffold generator supports this,
on 2005-12-20 06:29
err, nevermind, I think I figured this out... like I said, I'm new :O)