質問編集履歴

2

ログを追加。

2020/06/25 20:54

投稿

sassan738
sassan738

スコア32

test CHANGED
File without changes
test CHANGED
@@ -378,4 +378,78 @@
378
378
 
379
379
  ```
380
380
 
381
+ フォームを送信した時のログは以下の通りです。
382
+
383
+ ```ここに言語を入力
384
+
385
+ Started POST "/reviews" for 172.18.0.1 at 2020-06-25 20:52:50 +0000
386
+
387
+ Cannot render console from 172.18.0.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
388
+
389
+ Processing by ReviewsController#create as HTML
390
+
391
+ Parameters: {"utf8"=>"✓", "authenticity_token"=>"93R7dbCejITKT8m6U9vsXGRwyoZFYkCdnuPorhrZQceJShF7CqiHjWeDZwqX2o61OP5ll6P600aQjNbYAROnWw==", "review"=>{"score"=>"5", "title"=>"", "review"=>"hoge", "images"=>[#<ActionDispatch::Http::UploadedFile:0x00007fac64326cd0 @tempfile=#<Tempfile:/tmp/RackMultipart20200625-1-fr3buu.jpg>, @original_filename="バイオ3.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"review[images][]\"; filename=\"\xE3\x83\x8F\xE3\x82\x99\xE3\x82\xA4\xE3\x82\xAA\xEF\xBC\x93.jpg\"\r\nContent-Type: image/jpeg\r\n">]}, "game_id"=>"4", "commit"=>"投稿"}
392
+
393
+ User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
394
+
395
+ ↳ app/helpers/sessions_helper.rb:23
396
+
397
+  Disk Storage (6.3ms) Uploaded file to key: MKZwRH7SmEZbxnv6S2R9VzBX (checksum: NC1O8MLXS28QNfdAsUVu8g==)
398
+
399
+  (0.2ms) BEGIN
400
+
401
+ ↳ app/controllers/reviews_controller.rb:11
402
+
403
+ ActiveStorage::Blob Create (0.3ms) INSERT INTO "active_storage_blobs" ("key", "filename", "content_type", "metadata", "byte_size", "checksum", "created_at") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id" [["key", "MKZwRH7SmEZbxnv6S2R9VzBX"], ["filename", "バイオ3.jpg"], ["content_type", "image/jpeg"], ["metadata", "{\"identified\":true}"], ["byte_size", 19053], ["checksum", "NC1O8MLXS28QNfdAsUVu8g=="], ["created_at", "2020-06-25 20:52:50.916214"]]
404
+
405
+ ↳ app/controllers/reviews_controller.rb:11
406
+
407
+  (0.5ms) COMMIT
408
+
409
+ ↳ app/controllers/reviews_controller.rb:11
410
+
411
+  (0.2ms) BEGIN
412
+
413
+ ↳ app/controllers/reviews_controller.rb:13
414
+
415
+ Game Load (0.2ms) SELECT "games".* FROM "games" WHERE "games"."id" = $1 LIMIT $2 [["id", 4], ["LIMIT", 1]]
416
+
417
+ ↳ app/controllers/reviews_controller.rb:13
418
+
419
+ Review Exists (0.4ms) SELECT 1 AS one FROM "reviews" WHERE "reviews"."user_id" = $1 AND "reviews"."game_id" = $2 LIMIT $3 [["user_id", 1], ["game_id", 4], ["LIMIT", 1]]
420
+
421
+ ↳ app/controllers/reviews_controller.rb:13
422
+
423
+ ActiveStorage::Attachment Exists (0.3ms) SELECT 1 AS one FROM "active_storage_attachments" WHERE "active_storage_attachments"."blob_id" = $1 LIMIT $2 [["blob_id", 61], ["LIMIT", 1]]
424
+
425
+ ↳ app/models/review.rb:40
426
+
427
+ ActiveStorage::Blob Destroy (0.4ms) DELETE FROM "active_storage_blobs" WHERE "active_storage_blobs"."id" = $1 [["id", 61]]
428
+
429
+ ↳ app/models/review.rb:40
430
+
431
+  Disk Storage (0.5ms) Deleted file from key: MKZwRH7SmEZbxnv6S2R9VzBX
432
+
433
+  Disk Storage (0.9ms) Deleted files by key prefix: variants/MKZwRH7SmEZbxnv6S2R9VzBX/
434
+
435
+  (0.2ms) ROLLBACK
436
+
437
+ ↳ app/controllers/reviews_controller.rb:13
438
+
439
+ Rendering reviews/new.html.erb within layouts/application
440
+
441
+ Rendered shared/_error_messages.html.erb (0.9ms)
442
+
443
+ Rendered reviews/_reviews_form.html.erb (14.8ms)
444
+
445
+ Rendered reviews/new.html.erb within layouts/application (24.1ms)
446
+
447
+ Rendered layouts/_header.html.erb (1.7ms)
448
+
449
+ Completed 200 OK in 179ms (Views: 148.2ms | ActiveRecord: 2.9ms)
450
+
451
+
452
+
453
+ ```
454
+
381
455
  どこを修正すればいいかわからないのでアドバイスを頂きたいです。よろしくお願いします。

1

題名のタイプミスを修正

2020/06/25 20:53

投稿

sassan738
sassan738

スコア32

test CHANGED
@@ -1 +1 @@
1
- Active Storageのhas_may_attachedによって添付した画像に対してカスタムバリデーション を設定したいのですが、上手くきません。
1
+ Active Storageのhas_many_attachedによって添付した画像に対してカスタムバリデーション を設定したいのですが、上手くきません。
test CHANGED
File without changes