I'm working on a system that tracks illnesses and symptoms associated with them through Ruby on Rails. I have a "illnesses" table and a "symptoms" table and they have a many_to_many relationship through the "symptoms_illnesses" table. For now, I'm working on a page that displays a single entry of the "symptoms_illnesses" table. This table has two columns: illness_id and symptom_id.
I need a way to display the illness and symptom that match the ID.
Example:
"illness" table has "Common Cold" under id = 1
"symptom" table has "Fever" under id = 1
"symptoms_illness" table has illness_id = 1
and symptom_id = 1
.
I want the "symptoms_illness/1" page to display "Common Cold" and "Fever", but I see no obvious way to do it. Other topics in this site don't seem to address the problem in a satisfactory way.
Edit 1: I didn't add anything to the show action besides the "default"
def show
@symptoms_illness = Symptoms_illness.find(params[:id])
end