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

質問編集履歴

2

create

2017/02/28 06:39

投稿

kohekohe
kohekohe

スコア14

title CHANGED
File without changes
body CHANGED
@@ -85,5 +85,5 @@
85
85
  ```
86
86
 
87
87
 
88
- 現在デザインは上記のようになっておりますが、Updateした後にカテゴリーがDBに反映されません。
88
+ 現在デザインは上記のようになっておりますが、createした後にカテゴリーがDBに反映されません。
89
89
  もし、解決方法などがわかる方がおりましたらご教示いただければと存じます。よろしくお願いします。

1

ログ情報追加

2017/02/28 06:39

投稿

kohekohe
kohekohe

スコア14

title CHANGED
File without changes
body CHANGED
@@ -57,5 +57,33 @@
57
57
 
58
58
  ![![イメージ説明](bd22063e40a757879b23fc7dbd4506f6.png)](e6a3ada052691e3ca1d5d5a185790983.png)
59
59
 
60
+ 操作時のログは以下です。
61
+
62
+ ```lang-terminal
63
+ Started POST "/admin/products" for ::1 at 2017-02-28 15:06:43 +0900
64
+ Processing by Admin::ProductsController#create as HTML
65
+ Parameters: {"utf8"=>"✓", "authenticity_token"=>"qGGzmXU9qmlh/beJywM2iXsKBS1p1bMFQocEg4X3peuNiE1Xvmm/ZMWt53CKy2uJZjtRpmAaKu/62CEnPB39zQ==", "product"=>{"name"=>"test", "price"=>"100", "category_products_attributes"=>{"0"=>{"category_id"=>"2"}}}, "commit"=>"Create Product"}
66
+ AdminUser Load (0.4ms) SELECT `admin_users`.* FROM `admin_users` WHERE `admin_users`.`id` = 1 ORDER BY `admin_users`.`id` ASC LIMIT 1
67
+ Unpermitted parameter: category_products_attributes
68
+ (0.2ms) BEGIN
69
+ SQL (5.1ms) INSERT INTO `products` (`name`, `price`, `created_at`, `updated_at`) VALUES ('test', 100, '2017-02-28 06:06:43', '2017-02-28 06:06:43')
70
+ (0.7ms) COMMIT
71
+ Redirected to http://localhost:3000/admin/products/2
72
+ Completed 302 Found in 36ms (ActiveRecord: 6.3ms)
73
+
74
+
75
+ Started GET "/admin/products/2" for ::1 at 2017-02-28 15:06:43 +0900
76
+ Processing by Admin::ProductsController#show as HTML
77
+ Parameters: {"id"=>"2"}
78
+ AdminUser Load (0.3ms) SELECT `admin_users`.* FROM `admin_users` WHERE `admin_users`.`id` = 1 ORDER BY `admin_users`.`id` ASC LIMIT 1
79
+ Product Load (0.4ms) SELECT `products`.* FROM `products` WHERE `products`.`id` = 2 LIMIT 1
80
+ (0.5ms) SELECT COUNT(*) FROM `active_admin_comments` WHERE `active_admin_comments`.`resource_type` = 'Product' AND `active_admin_comments`.`resource_id` = '2' AND `active_admin_comments`.`namespace` = 'admin'
81
+ CACHE (0.0ms) SELECT COUNT(*) FROM `active_admin_comments` WHERE `active_admin_comments`.`resource_type` = 'Product' AND `active_admin_comments`.`resource_id` = '2' AND `active_admin_comments`.`namespace` = 'admin' [["resource_type", "Product"], ["resource_id", "2"], ["namespace", "admin"]]
82
+ Rendered /Users/Kohei/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/bundler/gems/activeadmin-6966a84c950b/app/views/active_admin/resource/show.html.arb (264.0ms)
83
+ Completed 200 OK in 271ms (Views: 266.8ms | ActiveRecord: 1.3ms)
84
+
85
+ ```
86
+
87
+
60
88
  現在デザインは上記のようになっておりますが、Updateした後にカテゴリーがDBに反映されません。
61
89
  もし、解決方法などがわかる方がおりましたらご教示いただければと存じます。よろしくお願いします。