質問編集履歴

1

試したこと追記

2023/01/11 01:39

投稿

you88
you88

スコア147

test CHANGED
File without changes
test CHANGED
@@ -39,3 +39,42 @@
39
39
 
40
40
  ```
41
41
 
42
+ ### 試したこと
43
+
44
+ うまく保存ができていなかったのでパラメーターを確認
45
+
46
+ 投稿時に下記パラメーターで保存されているのを確認
47
+
48
+ ```
49
+ Parameters: {"authenticity_token"=>"", "plan"=>{"name"=>"test", "price"=>"9800", "description"=>"テスト", "plan_category_id"=>"1", "request"=>"true", "trial"=>"false", "user_id"=>"1"}, "commit"=>"登録する"}
50
+ ```
51
+
52
+ paramsの定義を下記に直した
53
+
54
+ ```
55
+ let!(:plan_params) { { plan: {
56
+ id: 1,
57
+ name: "テストプラン",
58
+ description: "テストプランのdescription",
59
+ price: 9800,
60
+ stripe_product_id: "dqdqwdqw",
61
+ stripe_price_id: "dwqnjdnqiwdnq",
62
+ request:true,
63
+ public:true,
64
+ trial: true,
65
+ rating: 3,
66
+ user_id: user_01.id,
67
+ plan_category_id: 1
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
73
+ しかしPlan.createした際に下記のエラー
74
+
75
+ ```
76
+ *** ActiveModel::UnknownAttributeError Exception: unknown attribute 'plan' for Plan.
77
+ ```
78
+
79
+ 実際に投稿する際には下記のパラーメーターなのでなんでplanが認識されないのかわからず。。。
80
+