Copying attachment_fu file uploads

I could copy all images for the product and create new rows in the product_images table (the one used by attachment_fu) but this seems a bit inelegant, does anybody know a 'better' way or if attachment_fu supports this functionality in some way ?

Nope, it doesn't support that. But if it did, it'd probably create new rows in your attachment table and copy over the attachments to the new copied records.

You should probably send 'img' to #temp_path. Those are TempFile objects, and they will automatically be deleted when they're garbage collected. So, you'll lose the reference to them by passing img.path, and there's a chance the file won't be there when you go to save it. If you pass the TempFile instance, it won't get garbage collected until after the rails request has completed.

Sorry to be dim, but could someone post exactly the code which worked and where in the attachment_fu.rb file it sits?

I've tried lots of different ways, and although the image file appears to save, I keep getting a weird IOError error on saving the object itself

Thanks in advance.

Terry

Faster version here: http://www.williambharding.com/blog/rails/rails-faster-clonecopy-of-attachment_fu-images/

Bill Harding wrote: