質問編集履歴

1

modelの情報を追加しました

2019/11/22 12:58

投稿

nasuk47
nasuk47

スコア311

test CHANGED
File without changes
test CHANGED
@@ -202,6 +202,60 @@
202
202
 
203
203
 
204
204
 
205
+ ```model
206
+
207
+ class Member < ApplicationRecord
208
+
209
+ has_many :use_members
210
+
211
+ has_many :user, through: :user_members
212
+
213
+ has_many :member_comments
214
+
215
+ has_many :comments, through: :member_comments
216
+
217
+ end
218
+
219
+
220
+
221
+ ```
222
+
223
+ ```model
224
+
225
+ class Comment < ApplicationRecord
226
+
227
+ has_many :user_commnents
228
+
229
+ has_many :comment, through: :user_comments
230
+
231
+ has_many :member_comments
232
+
233
+ has_many :comment, through: :member_comments
234
+
235
+ end
236
+
237
+
238
+
239
+
240
+
241
+ ```
242
+
243
+ ```model
244
+
245
+ class MemberComment < ApplicationRecord
246
+
247
+ belongs_to :member
248
+
249
+ belongs_to :comment
250
+
251
+ end
252
+
253
+
254
+
255
+ ```
256
+
257
+
258
+
205
259
 
206
260
 
207
261