How can I have two controllers use the same 'category' model if they aren't related?

Hi all,

I have two controllers - "foods" and "receipes" which map to models.
Each one will have multiple categories, but the categories are
completely different for each one - they don't share the same
category. So they aren't related at all.

If I wanted to do this using resources, what is the best way to set
this up? If I setup a categories controller and category model, I
would be able to have /categories, /categories/1/foods but how would
it know to list only the categories for food or receipes? Because I'd
like to have an interface using resources to do basic CRUD operations
on categories.

The only way I came up with would be to have a different category for
both foods and receipes - /cat_foods/1/foods, /cat_receipes/1/recipes,
but that looks really ugly and I'm sure there's an easier way I'm not
getting.

Thanks for any help!
Rob

Hi.
I think the best solution is create column with categories table, named
like "category_type" type boolean (for example). And let if category is
foods category, the value in this column should set 1 (true), else 0
(false). Then in model Food, write:
belongs_to :category, :conditions => "category_type = 1"
in Receipes model:
belongs_to :category, :condifions => "category_type = 0"
in Category model:
has_many :foods
has_many :receipes
And you obtain all advantages of relationsheeps one-to-many in both
models.

Best Regards, Sergey