I’m building out an application that will be using REST. Here is the
model. I have a list of drugs. Each drug belongs to one of 2 domains,
i.e. dental or medical. Each domain has any number of categories, i.e.
antibiotic, anesthetic, etc.
So, you could have a drug(s) that is medical antibiotics or a drug(s)
that is a dental anesthetic.
The final point is that each individual drug has a single generic name
and multiple trade names.
I want to be able to create routes like these:
This route would display all the drugs in the given domain:
(ex: /drugs/medical or /drugs/dental)
This route would represent all the drugs of a particular domain that are
also part of that domains category, i.e. all medical drugs that are
antibiotics or all dental drugs that are dental anesthetics:
(ex: /drugs/medical/antibiotics or /drugs/dental/anethetics)
This route will display all of the trade names for a particular drug,
i.e. all the trade names for articaine (if articaine is the generic
So, the root of my question is, how do I go about designing the
controllers? Should I build a controller for drugs, domains, categories
Domains, categories and trade_names are really just a different way of
display a drug. Would it be better to work on some map.resources
tomfoolery to handle the cases and create some new actions in the drug
Any advice would be most appreciated.