Forum: Ruby on Rails Iterating over a params hash

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Taylor S. (Guest)
on 2007-03-19 00:57
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

Hash from form:
{"commit"=>"Add", "picture"=>{"1"=>{"title"=>"dsfsdf",

      params[:picture].each { |image|
                            new_image =
                            new_image.title = image[:title]
                            new_image.image = image[:image_data]

                           end }

TypeError in ImagesController#new
Symbol as array index
Bogdan I. (Guest)
on 2007-03-19 01:14
(Received via mailing list)
params[:picture].each_pair {|key,value|

value will be the has containing values for each individual picture
Taylor S. (Guest)
on 2007-03-19 02:44
jko170 (Guest)
on 2007-05-05 12:54
(Received via mailing list)
Couldn't you just do:
params[:picture].each_value |image|
This topic is locked and can not be replied to.