回答編集履歴

1

x

2023/01/07 07:22

投稿

yuma.inaura
yuma.inaura

スコア1453

test CHANGED
@@ -1,2 +1,15 @@
1
1
  createは失敗してもfalse扱いされるわけではないので
2
2
  .persisted? とかで条件分けしたら良いかも
3
+
4
+ ```rb
5
+ def create
6
+ create = Prototype.create(prototype_params)
7
+
8
+ if create.persisted?
9
+ redirect_to root_path
10
+ else
11
+ render :new
12
+ end
13
+ end
14
+
15
+ ```