回答編集履歴

1

情報追加

2019/10/26 09:32

投稿

winterboum
winterboum

スコア23349

test CHANGED
@@ -11,3 +11,17 @@
11
11
  <% f.hidden_field :parent_id %>
12
12
 
13
13
  で済みます。form_with @post だったっけ、、、
14
+
15
+ #####
16
+
17
+ def new
18
+
19
+ @post = Post.new
20
+
21
+ end
22
+
23
+ ですと、
24
+
25
+ <% f.hidden_field :parent_id, @post.id %>
26
+
27
+ の @post.id は nil になりますよ