質問編集履歴

1

エラー情報を最新の内容に更新

2017/08/17 13:45

投稿

abab7200
abab7200

スコア120

test CHANGED
File without changes
test CHANGED
@@ -1,6 +1,6 @@
1
1
  画像アップロードの gem refile利用し、データ登録をしようとしています。
2
2
 
3
- その際に登録フォームから送信した際にundefined method `eyecatch_id_will_change!' となります。
3
+ その際に登録フォームから送信した際にundefined method `eyecatch_id_id_will_change!' となります。
4
4
 
5
5
  どなたかご教授頂ければと存じます。
6
6
 
@@ -14,7 +14,7 @@
14
14
 
15
15
  = f.input :title
16
16
 
17
- = f.attachment_field :eyecatch
17
+ = f.attachment_field :eyecatch_id
18
18
 
19
19
  = f.input :content
20
20
 
@@ -34,7 +34,7 @@
34
34
 
35
35
 
36
36
 
37
- attachment :eyecatch
37
+ attachment :eyecatch_id
38
38
 
39
39
 
40
40
 
@@ -55,6 +55,8 @@
55
55
 
56
56
 
57
57
  def create
58
+
59
+ #ここでエラーになる
58
60
 
59
61
  @article = Article.new(article_params)
60
62
 
@@ -80,7 +82,7 @@
80
82
 
81
83
  def article_params
82
84
 
83
- params.require(:article).permit(:title, :content, :publish_time, :eyecatch)
85
+ params.require(:article).permit(:title, :content, :publish_time, :eyecatch_id)
84
86
 
85
87
  end
86
88
 
@@ -90,16 +92,40 @@
90
92
 
91
93
  ```ここに言語を入力
92
94
 
93
- Processing by ArticlesController#create as HTML
94
95
 
95
- Parameters: {"utf8"=>"✓", "authenticity_token"=>"+9KeBu4uhUUboQaDk+iM29haCqhoFI4NpUdbY21wLoTxgiuSQ1+g4KTlQtbMpYHUw7xlK0Rl/Kv8jmU6rPP2ww==", "article"=>{"title"=>"daa", "eyecatch"=>#<ActionDispatch::Http::UploadedFile:0x007fff4c974160 @tempfile=#<Tempfile:/var/folders/4v/dsv8p_992w1f1f5bjqfwrp2h0000gn/T/RackMultipart20170815-13588-1g3qka4.jpg>, @original_filename="桜.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"article[eyecatch]\"; filename=\"\xE6\xA1\x9C.jpg\"\r\nContent-Type: image/jpeg\r\n">, "content"=>"da", "publish_time(1i)"=>"2017", "publish_time(2i)"=>"8", "publish_time(3i)"=>"15", "publish_time(4i)"=>"13", "publish_time(5i)"=>"07"}, "commit"=>"送信"}
96
96
 
97
- Completed 500 Internal Server Error in 34ms (ActiveRecord: 0.0ms)
97
+ undefined method `eyecatch_id_id_will_change!' for #<Article:0x007fbccb5e5bc0>
98
98
 
99
99
 
100
100
 
101
- NoMethodError (undefined method `eyecatch_id_will_change!' for #<Article:0x007fff4c95d7d0>):
101
+ {"utf8"=>"✓",
102
102
 
103
+ "authenticity_token"=>"qf3QBJDOsKGsab2bOSPuwrmH4lPphINBb8AjXDr2vsFlx6z4WBU68cPI6EHf+JsQs0sw09Yb/Y7PscTIC7m/Rg==",
104
+
103
- app/controllers/articles_controller.rb:12:in `create'
105
+ "article"=>{"title"=>"だだだ",
106
+
107
+ "eyecatch_id"=>#<ActionDispatch::Http::UploadedFile:0x007fbcd1e5c028 @tempfile=#<Tempfile:/var/folders/4v/dsv8p_992w1f1f5bjqfwrp2h0000gn/T/RackMultipart20170817-6393-tb00jm.jpg>,
108
+
109
+ @original_filename="Ckk7iw5VAAAGtin.jpg",
110
+
111
+ @content_type="image/jpeg",
112
+
113
+ @headers="Content-Disposition: form-data; name=\"article[eyecatch_id]\"; filename=\"Ckk7iw5VAAAGtin.jpg\"\r\nContent-Type: image/jpeg\r\n">,
114
+
115
+ "content"=>"だだ",
116
+
117
+ "publish_time(1i)"=>"2017",
118
+
119
+ "publish_time(2i)"=>"8",
120
+
121
+ "publish_time(3i)"=>"17",
122
+
123
+ "publish_time(4i)"=>"13",
124
+
125
+ "publish_time(5i)"=>"41"},
126
+
127
+ "commit"=>"送信"}
128
+
129
+
104
130
 
105
131
  ```