質問編集履歴
1
追記に書きかました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -52,11 +52,11 @@
|
|
52
52
|
|
53
53
|
<img>
|
54
54
|
|
55
|
-
<input type="file" class="sell-upload-drop-file" multiple="multiple" name="image" style="display: none">
|
55
|
+
<input type="file" class="sell-upload-drop-file" multiple="multiple" name="image[]" style="display: none">
|
56
56
|
|
57
57
|
<pre class="visible-pc-1">ドラッグアンド<br>ドロップ<br>またはクリックして<br>ファイルを<br>アップロード</pre>
|
58
58
|
|
59
|
-
<%=image.file_field :image
|
59
|
+
<%=image.file_field :image %>
|
60
60
|
|
61
61
|
</figure>
|
62
62
|
|
@@ -72,11 +72,11 @@
|
|
72
72
|
|
73
73
|
<img>
|
74
74
|
|
75
|
-
<input type="file" class="sell-upload-drop-file" multiple="multiple" name="image" style="display: none">
|
75
|
+
<input type="file" class="sell-upload-drop-file" multiple="multiple" name="image[]" style="display: none">
|
76
76
|
|
77
77
|
<pre class="visible-pc-2">ドラッグアンド<br>ドロップ<br>またはクリックして<br>ファイルを<br>アップロード</pre>
|
78
78
|
|
79
|
-
<%= image.file_field :image
|
79
|
+
<%= image.file_field :image %>
|
80
80
|
|
81
81
|
</figure>
|
82
82
|
|
@@ -194,7 +194,7 @@
|
|
194
194
|
|
195
195
|
:name,
|
196
196
|
|
197
|
-
item_images_attributes:
|
197
|
+
item_images_attributes: :images
|
198
198
|
|
199
199
|
)
|
200
200
|
|
@@ -251,3 +251,31 @@
|
|
251
251
|
end
|
252
252
|
|
253
253
|
```
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
追記
|
258
|
+
|
259
|
+
new.html.erb
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
<input type="file" class="sell-upload-drop-file" multiple="multiple" name="image" style="display: none">のname="image"を、name="image[]"に変更
|
264
|
+
|
265
|
+
他にもname="image-1"や"image-2"と名前を別々にして試しました。
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
<%= image.file_field :image, multiple: "true" %>を、<%= image.file_field :image %>に変更。
|
270
|
+
|
271
|
+
paramsを受け取れなかったため。
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
items_controller.rb
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
item_images_attributes: {images: []}を、item_images_attributes: :imagesに変更。
|
280
|
+
|
281
|
+
上記同様、paramsを受け取れなかったため。
|