Good effort! Here are my notes on your code:
###Your current associations###
- Three of your current assocations accurately reflect the schema: the association on your Dog model, and the assocations on your Rating model. Nice!
- Unfortunately, your other association does not reflect the given schema, since each person (as a judge) can have more than one rating. Hint: Take a look at the docs for has_many.
###Your missing associations###
- Take a look at the schema for this challenge. It contains 4 relationships (each of the three lines is a relationship, and the many-to-many relationship created by the red and green lines combined is also a relationship.) This means you will need to end up with a total of 8 associations on your models (since each relationship requires an association on each end of the relationship). This means you are missing 4 associations.
###Big hints###
- One-to-many relationships get a
has_many
on the 'one' side, and abelongs_to
on the 'many' side. (Look at the red line in the schema. For that relationship, thehas_many
goes on the Person model, and thebelongs_to
goes on the Rating model. This is because each person (aka judge) can have many ratings (since they are rating many dogs).) You will need to set up a total of three of these one-to-many relationships. - Many-to-many relationships get a has_many :through on each side of the relationship. You will need one of these relationships, between the Person model and Dog model.
If you get time, revisit this challenge. Any questions let me know.
-Phil