I’ve got a model, “category” and another model “subcategory.” Each
subcategory belongs_to a category, and a category has_many
subcategories.
What I need to do is set it up so that I can search Category and
Subcategory with one .find call. So:
Category.find(:all, <etc)
will find categories and subcategories.
Now, I believe this can be done by making Subcategory a subclass of
Category. Am I right? Unfortunately, there’s almost nothing in AWD about
subclasses and has_many relationships, so I’m lost. I tried to just
change Subcategory to extend Category in the model, but that led to
errors (no such field: “categories.category_id”). What else do I need to
change to allow Subcategory to extend Category and also belong_to a
category?
Thanks,
Adam