I'm having a problem uploading multiple images via Carrierwave and am not sure if it's a bug or user error (probably the latter). I'm doing everything in a rather standard way though (as per documentation) so it's weird that this doesn't work.
I have the following in my Gemfile:
gem 'carrierwave', github: 'carrierwaveuploader/carrierwave'
my image_uploader.rb:
class ImageUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
version :thumb do
process :resize_to_limit => [590, 590]
end
version :featured do
process :resize_to_fill => [390, 390]
end
def extension_white_list
%w(jpg jpeg gif png)
end
end
My article.rb file:
class Article < ActiveRecord::Base
mount_uploaders :images, ImageUploader
end
I am letting the params pass from my controller with:
def article_params
params.require(:article).permit(:title, :images, :body)
end
And the _form.html.erb partial uses:
<%= form_for @article, html: { multipart: true } do |f| %>
<%= f.label :images %><br>
<%= f.file_field :images, multiple: true %><br>
<%= f.submit 'Update Article' %>
<% end %>
Oddly, when I upload two images, I am not seeing them passed into the article_params from the update method.
If I pry it, I can see that:
params.require(:article).permit(:images)
Unpermitted parameters: title, images, body
=> {}
Images seems to be unpermitted, even though I explicitly permit it...
Any clue as to what may be incorrect here?