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

Commit 00b1504

Browse files
committed
Rename assocaitons
1 parent dab0516 commit 00b1504

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

app/models/film.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ class Film < ApplicationRecord
1010
association_foreign_key: 'person_id'
1111

1212
has_many :ratings
13-
has_many :users, through: :ratings
13+
has_many :critics, through: :ratings, source: :user
1414
end

app/models/rating.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ class Rating < ApplicationRecord
22
belongs_to :user
33
belongs_to :film
44

5-
validates_inclusion_of :number, :in => 0..5
5+
validates_inclusion_of :number, in: 0..5
66
end

app/models/user.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
class User < ApplicationRecord
22
has_many :ratings
3-
has_many :films, through: :ratings
3+
has_many :rated_films, through: :ratings, source: :film
44
end

0 commit comments

Comments
 (0)