質問編集履歴

2

追記

2020/08/09 07:15

投稿

yastinbieber
yastinbieber

スコア49

test CHANGED
File without changes
test CHANGED
@@ -32,41 +32,41 @@
32
32
 
33
33
 
34
34
 
35
- ```
36
-
37
- From: /home/ec2-user/environment/toreka/app/controllers/advicediaries_controller.rb:73 AdvicediariesController#create:
38
-
39
-
40
-
41
- 71: def create
42
-
43
- 72: @form = Form::AdvicediaryCollection.new(advicediary_collection_params)
44
-
45
- => 73: binding.pry
46
-
47
- 74: if @form.save
48
-
49
- 75: redirect_to advicediaries_path
50
-
51
- 76: else
52
-
53
- 77: redirect_to choice_advicediaries_path
54
-
55
- 78: end
56
-
57
- 79: end
58
-
59
-
60
-
61
- [1] pry(#<AdvicediariesController>)> @form.errors.messages
62
-
63
- => {}
64
-
65
- [2] pry(#<AdvicediariesController>)> params
66
-
67
- => <ActionController::Parameters {"utf8"=>"✓", "authenticity_token"=>"XdMtiREff9i0JhfPTMqAiD90TkzYu+Lfz0JGGJEyYvxHJ7ocaaOYz9tD5921tnUbDz5H187f+dLV5R1QZA13vQ==", "form_advicediary_collection"=><ActionController::Parameters {"advicediaries_attributes"=>{"0"=>{"advicemenu_id"=>"1", "weight"=>"100", "reps"=>"10", "weightsecond"=>"100", "repssecond"=>"10", "weightthird"=>"100", "repsthird"=>"10", "memo"=>"test1", "user_id"=>"12", "idealweight_id"=>"6", "useradvice_id"=>"8"}, "1"=>{"advicemenu_id"=>"2", "weight"=>"120", "reps"=>"10", "weightsecond"=>"120", "repssecond"=>"10", "weightthird"=>"120", "repsthird"=>"10", "memo"=>"test2", "user_id"=>"12", "idealweight_id"=>"6", "useradvice_id"=>"8"}, "2"=>{"advicemenu_id"=>"3", "weight"=>"60", "reps"=>"10", "weightsecond"=>"60", "repssecond"=>"10", "weightthird"=>"60", "repsthird"=>"10", "memo"=>"test3", "user_id"=>"12", "idealweight_id"=>"6", "useradvice_id"=>"8"}, "3"=>{"advicemenu_id"=>"4", "weight"=>"0", "reps"=>"10", "weightsecond"=>"0", "repssecond"=>"10", "weightthird"=>"0", "repsthird"=>"10", "memo"=>"test4", "user_id"=>"12", "idealweight_id"=>"6", "useradvice_id"=>"8"}}} permitted: false>, "commit"=>"今日のトレーニングを完了する", "controller"=>"advicediaries", "action"=>"create"} permitted: false>
68
-
69
- [3] pry(#<AdvicediariesController>)>
35
+
36
+
37
+ ```
38
+
39
+ Parameters: {"utf8"=>"✓", "authenticity_token"=>"4jyslJtI/ALBv+pGEoSEb7ikIVHioo+6ZAkN4XkcEHEbAi/MeJr8RvS+/XDAh7nMJOHfrFGpiTDt8yI8kwq6KQ==", "form_advicediary_collection"=>{"advicediaries_attributes"=>{"0"=>{"advicemenu_id"=>"1", "weight"=>"100", "reps"=>"10", "weightsecond"=>"100", "repssecond"=>"10", "weightthird"=>"100", "repsthird"=>"10", "memo"=>"1", "user_id"=>"9", "idealweight_id"=>"4", "useradvice_id"=>"6"}, "1"=>{"advicemenu_id"=>"2", "weight"=>"100", "reps"=>"10", "weightsecond"=>"100", "repssecond"=>"10", "weightthird"=>"100", "repsthird"=>"10", "memo"=>"2", "user_id"=>"9", "idealweight_id"=>"4", "useradvice_id"=>"6"}, "2"=>{"advicemenu_id"=>"3", "weight"=>"50", "reps"=>"10", "weightsecond"=>"50", "repssecond"=>"10", "weightthird"=>"50", "repsthird"=>"10", "memo"=>"3", "user_id"=>"9", "idealweight_id"=>"4", "useradvice_id"=>"6"}, "3"=>{"advicemenu_id"=>"4", "weight"=>"0", "reps"=>"10", "weightsecond"=>"0", "repssecond"=>"10", "weightthird"=>"0", "repsthird"=>"10", "memo"=>"4", "user_id"=>"9", "idealweight_id"=>"4", "useradvice_id"=>"6"}}}, "commit"=>"今日のトレー ニングを完了する"}
40
+
41
+ User Load (0.2ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 9 ORDER BY `users`.`id` ASC LIMIT 1
42
+
43
+ /home/ec2-user/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.4.3/lib/active_record/log_subscriber.rb:98
44
+
45
+ Unpermitted parameters: :user_id, :idealweight_id, :useradvice_id
46
+
47
+ Unpermitted parameters: :user_id, :idealweight_id, :useradvice_id
48
+
49
+ Unpermitted parameters: :user_id, :idealweight_id, :useradvice_id
50
+
51
+ Unpermitted parameters: :user_id, :idealweight_id, :useradvice_id
52
+
53
+ (0.1ms) BEGIN
54
+
55
+ app/models/form/advicediary_collection.rb:15
56
+
57
+ Advicemenu Load (0.2ms) SELECT `advicemenus`.* FROM `advicemenus` WHERE `advicemenus`.`id` = 1 LIMIT 1
58
+
59
+ ↳ app/models/form/advicediary_collection.rb:16
60
+
61
+ (0.2ms) ROLLBACK
62
+
63
+ ↳ app/models/form/advicediary_collection.rb:15
64
+
65
+ Redirected to https://ae4965dfa4a04e8c87367d6e80606bec.vfs.cloud9.ap-northeast-1.amazonaws.com/advicediaries/choice
66
+
67
+ Completed 302 Found in 104ms (ActiveRecord: 3.6ms)
68
+
69
+
70
70
 
71
71
  ```
72
72
 

1

追記

2020/08/09 07:15

投稿

yastinbieber
yastinbieber

スコア49

test CHANGED
File without changes
test CHANGED
@@ -463,3 +463,11 @@
463
463
  別途なにか必要な情報がありました仰ってください。
464
464
 
465
465
  何卒宜しくお願いします。
466
+
467
+
468
+
469
+ ## 追記
470
+
471
+ 要は1つのフォームで同モデルのレコードを一括複数登録できれば良いです。
472
+
473
+ もし別途やり方等ございましたら教えていただけますと幸いです。