teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

modelの情報を追加しました

2019/11/22 12:58

投稿

nasuk47
nasuk47

スコア311

title CHANGED
File without changes
body CHANGED
@@ -100,8 +100,35 @@
100
100
  end
101
101
  ```
102
102
 
103
+ ```model
104
+ class Member < ApplicationRecord
105
+ has_many :use_members
106
+ has_many :user, through: :user_members
107
+ has_many :member_comments
108
+ has_many :comments, through: :member_comments
109
+ end
103
110
 
111
+ ```
112
+ ```model
113
+ class Comment < ApplicationRecord
114
+ has_many :user_commnents
115
+ has_many :comment, through: :user_comments
116
+ has_many :member_comments
117
+ has_many :comment, through: :member_comments
118
+ end
104
119
 
120
+
121
+ ```
122
+ ```model
123
+ class MemberComment < ApplicationRecord
124
+ belongs_to :member
125
+ belongs_to :comment
126
+ end
127
+
128
+ ```
129
+
130
+
131
+
105
132
  ### 試したこと
106
133
 
107
134
  https://programming-beginner-zeroichi.jp/articles/25