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

質問編集履歴

2

タイトル変更

2021/07/23 15:53

投稿

退会済みユーザー
title CHANGED
@@ -1,1 +1,1 @@
1
- gem 'cocoon'を使用した入力フォーム追加•削除機能でのエラー”undefined method `new_record?' for nil:NilClass”
1
+ 入力フォーム追加•削除機能でのエラー”undefined method `new_record?' for nil:NilClass”
body CHANGED
File without changes

1

エラーメッセージ画像表示されず、入力しました。

2021/07/23 15:53

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -11,7 +11,29 @@
11
11
  ### エラーメッセージ
12
12
 
13
13
  ```
14
+ NoMethodError in Posts#new
15
+ Showing /myapp/app/views/items/_items_fields.html.erb where line #33 raised:
16
+
17
+ undefined method `new_record?' for nil:NilClass
18
+ Extracted source (around line #33):
19
+ 31    </div>
20
+ 32    <!-- 削除ボタン -->
21
+ 33    <%= link_to_remove_association "削除", f %>
22
+ 34    <% end %>
23
+ 35    </td>
24
+ 36    </tr>
25
+
26
+ Trace of template inclusion: #<ActionView::Template app/views/posts/new.html.erb locals=[]>
27
+
28
+ Rails.root: /myapp
29
+
14
- ![エラーメッセージ画像](fc96e19b570b3ac50fbf98b0c77a8f39.png)
30
+ Application Trace | Framework Trace | Full Trace
31
+ app/views/items/_items_fields.html.erb:33
32
+ app/views/items/_items_fields.html.erb:7
33
+ app/views/posts/new.html.erb:15
34
+ app/views/posts/new.html.erb:14
35
+ app/views/posts/new.html.erb:5
36
+
15
37
  ```
16
38
 
17
39
  ### 該当のソースコード