I would like to copy a record that has_many :pictures. Copying the record is a no brainer, but copying the Picture records is something else.
- The
Picturerecord has a link to aPost Picturehas an attribute (for Dragonfly) that isimage_uidthat contains a string like2016/08/17/3chjxpz97o_tfss_05bbc7ac_a432_4408_bf6e_a0fa3dc4630d_animage.jpeg
The image is stored on an AWS S3 server. From the server perspective I think this does
- Download the image (original record
image_uid) to the server - Attach the image to the new
Picturerecord - Reupload the image to AWS
- Is there a method that just copies it on AWS, gives you the new
image_uidso I can set it manually on the new record?
Thx
I have found how this is done. For people who might ever need this:
My original
Pictureobject:Duplicating this is actually not that hard. I used the
.dupmethod provided by Ruby. Copying multiple pictures:The
image:p.imageis where you do the actual image duplication.