質問編集履歴
1
アソシエーションの追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -75,4 +75,30 @@
|
|
75
75
|
記述を色々試しましたがうまくいきません。
|
76
76
|
|
77
77
|
初めてアプリケーションを一から作成しています。
|
78
|
-
お見苦しいところは多々あると思いますが、どうかご指導ください。
|
78
|
+
お見苦しいところは多々あると思いますが、どうかご指導ください。
|
79
|
+
|
80
|
+
追記ーーーー
|
81
|
+
|
82
|
+
アソシエーション
|
83
|
+
```user
|
84
|
+
devise :database_authenticatable, :registerable,
|
85
|
+
:recoverable, :rememberable, :validatable
|
86
|
+
has_many :contents, through: :comments
|
87
|
+
has_many :categories, through: :contents
|
88
|
+
has_many :comments
|
89
|
+
```
|
90
|
+
```category
|
91
|
+
belongs_to :user
|
92
|
+
has_many :contents
|
93
|
+
has_many :users, through: :contents
|
94
|
+
```
|
95
|
+
```content
|
96
|
+
belongs_to :user
|
97
|
+
belongs_to :category
|
98
|
+
has_many :user, through: :comments
|
99
|
+
```
|
100
|
+
```comment
|
101
|
+
belongs_to :user
|
102
|
+
belongs_to :content
|
103
|
+
```
|
104
|
+
となっています
|