質問編集履歴
2
タイポ修正
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
Rails : “いいね”機能の実装で
|
1
|
+
Rails : “いいね”機能の実装でroutes.rbでエラーが出てしまう
|
body
CHANGED
File without changes
|
1
スペルミス修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -27,7 +27,7 @@
|
|
27
27
|
class Product < ApplicationRecord
|
28
28
|
belongs_to :user
|
29
29
|
has_many :votes, dependent: :destroy
|
30
|
-
has_many :voters,
|
30
|
+
has_many :voters, through: :votes, source: :user
|
31
31
|
|
32
32
|
class << self
|
33
33
|
def search(query)
|
@@ -45,7 +45,7 @@
|
|
45
45
|
class User < ApplicationRecord
|
46
46
|
has_many :products, dependent: :destroy
|
47
47
|
has_many :votes, dependent: :destroy
|
48
|
-
has_many :voted_products,
|
48
|
+
has_many :voted_products, through: :votes, source: :product
|
49
49
|
|
50
50
|
before_validation do
|
51
51
|
self.email_for_index = email.downcase if email
|