I've a piece of code in my product model where I assign values to columns by fetching from s3. The column names includes a counter "i" as well -
The 3 sample column names are -
pic1_file_name
pic2_file_name
pic3_file_name
The problematic code is -
  prod = Product.find(id)
  i=1
  s3 = AWS::S3.new
  bucket=s3.buckets['bucket_name']
       bucket.objects.each do |obj|
          prod.("pic"+"#{i}".to_s+"_file_name")=obj.key[45..1]
          # the above line give a syntax error, unexpected '=', expecting end-of-input
          prod.("pic"+"#{i}".to_s+"_file_name").to_sym   = obj.key[45..-1]
          # The above line gives an error undefined method `call' for #<Product:0x7773f18>
          prod.send("pic"+"#{i}".to_s+"_file_name")=obj.key[45..-1]
          # The above gives syntax error, unexpected '=', expecting end-of-input
          i+=1
       end
    prod.save
Could you please advise as to how should I structure my column name with a variable so that I can assign a value to it without having to type 15 separate columns every time.
Any pointers will be appreciated.
Thanks in advance!
"pic#{i}_file_name"or"pic" + i.to_s + "_file_name"