I need to iterate over a params hash to upload multiple pictures at
once. My example only has one file for clarity. Any help would be
appreciated.
Hash from form:
{“commit”=>“Add”, “picture”=>{“1”=>{“title”=>“dsfsdf”,
“image_data_temp”=>"",
“image_data”=>#<File:C:/DOCUME~1/TAYLOR~1/LOCALS~1/Temp/CGI.1536.3>}}}
Controller:
params[:picture].each { |image|
new_image = Image.new
new_image.title = image[:title]
new_image.image = image[:image_data]
if new_image.save
end }
Error:
TypeError in ImagesController#new
Symbol as array index