質問編集履歴

3

comment修正

2021/04/26 21:04

投稿

ryota1107
ryota1107

スコア6

test CHANGED
File without changes
test CHANGED
@@ -114,7 +114,7 @@
114
114
 
115
115
  @comment = Comment.new
116
116
 
117
- @coments = @post.comments
117
+ @comments = @post.comments
118
118
 
119
119
 
120
120
 

2

postに修正

2021/04/26 21:04

投稿

ryota1107
ryota1107

スコア6

test CHANGED
File without changes
test CHANGED
@@ -188,7 +188,7 @@
188
188
 
189
189
  belongs_to :season
190
190
 
191
- has_many :Comment
191
+ has_many :comment
192
192
 
193
193
  with_options presence: true do
194
194
 

1

post.rbの追記

2021/04/26 20:58

投稿

ryota1107
ryota1107

スコア6

test CHANGED
File without changes
test CHANGED
@@ -174,4 +174,42 @@
174
174
 
175
175
  end
176
176
 
177
+ ```
178
+
179
+ ```post
180
+
181
+ class Post < ApplicationRecord
182
+
183
+ extend ActiveHash::Associations::ActiveRecordExtensions
184
+
185
+ belongs_to :user
186
+
187
+ has_one_attached :image
188
+
189
+ belongs_to :season
190
+
191
+ has_many :Comment
192
+
193
+ with_options presence: true do
194
+
195
+ validates :tops
196
+
197
+ validates :pants
198
+
199
+ validates :shoes
200
+
201
+ validates :season_id
202
+
203
+ validates :image
204
+
205
+ validates :season_id, numericality: { other_than: 1 }
206
+
207
+ end
208
+
209
+ end
210
+
211
+
212
+
213
+ ```
214
+
177
- ```![イメージ説明](7d4e4cd4825a3507b21b1a593b80139c.png)
215
+ ![イメージ説明](7d4e4cd4825a3507b21b1a593b80139c.png)