I am developing a system where the user inputs several symptoms and receives a list of all illnesses that match those symptoms. I haven't found a way to do so, however.
For example, if the user has "Fever" and "Sneezing" as symptoms, I want the system to find all illnesses that have both fever and sneezing as symptoms simultaneously and list them in no particular order.
I have three tables: illnesses, symptoms and illness_symptoms. Illnesses and Symptoms both have a has_many relationship through illness_symptoms.
Both Illnesses and Symptoms are similarly mapped: Text, description and id fields. illness_symptoms only has id_symptom and id_illness. Symptoms are "saved" to an illness through a form where one illness and one symptom are specified, though this is rudimentary and will be changed later.
Using @illness = symptom.illnesses I can find and list all illnesses that have one certain symptom but I'm not sure how to narrow it down for a second (and any subsequent) symptoms.