I've been using attachment_fu with db storage for a while, but I wanted to start using S3 storage instead. So I made the obvious changes: install aws-s3, create config/amazon_s3.yml, and change the has_attachment storage option to :s3.
This worked fine for any new files, but all the old files that were still in the database weren't displaying (obviously). So I ran the following to get them into S3:
(UploadedFile is the name of my only model calling has_attachment. Alter and repeat as necessary.)
UploadedFile.find(:all).each do |file|
if file.db_file_id?
file.temp_data = DbFile.find(file.db_file_id).data
file.save!
end
end
There might be a better way, but this worked for me.