Skip to content
This repository was archived by the owner on Sep 24, 2019. It is now read-only.

Conversation

@xuorig
Copy link
Collaborator

@xuorig xuorig commented Feb 12, 2017

association_foreign_key: 'person_id'

has_many :ratings
has_many :users, through: :ratings
Copy link
Contributor

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess critics :P

Copy link
Contributor

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.

belongs_to :user
belongs_to :film

validates_inclusion_of :number, :in => 0..5
Copy link
Contributor

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

@@ -0,0 +1,4 @@
class User < ApplicationRecord
has_many :ratings
has_many :films, through: :ratings
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:rated_films?

@xuorig xuorig merged commit 0f640c1 into master Feb 12, 2017
@xuorig xuorig deleted the ratings branch February 12, 2017 21:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants