-
Notifications
You must be signed in to change notification settings - Fork 1
Ratings model #26
Conversation
app/models/film.rb
Outdated
| association_foreign_key: 'person_id' | ||
|
|
||
| has_many :ratings | ||
| has_many :users, through: :ratings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:raters? if that's a word lol.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i guess critics :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! Yes!
It'll allow us to easily add field :critics in GraphQL type if we name the association correctly.
app/models/rating.rb
Outdated
| belongs_to :user | ||
| belongs_to :film | ||
|
|
||
| validates_inclusion_of :number, :in => 0..5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be able to do: in: 0..5
app/models/user.rb
Outdated
| @@ -0,0 +1,4 @@ | |||
| class User < ApplicationRecord | |||
| has_many :ratings | |||
| has_many :films, through: :ratings | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:rated_films?
@cjoudrey