imagekit-ruby
imagekit-ruby copied to clipboard
How to migrate files from local persistent storage with CarrierWave correctly?
Initially, the application used local persistent storage. I tried moving the entire uploads
directory into ImageKit. I kept the previous configuration and added a new one from ImageKit:
class BaseUploader < CarrierWave::Uploader::Base
include ImageKitIo::CarrierWave
def store_dir
full_file_path
end
# ...
def options
{
response_fields: "isPrivateFile, tags",
tags: %w[images],
use_unique_file_name: false,
folder: full_file_path
}
end
private
# ...
def full_file_path
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{dirs}"
end
# ...
end
As a result I get this error:
unexpected token at 'f1843b5f9.jpg'
From this line:
= image_tag band.card_image.url
In this case, the full name of the file in the database is: 9757131f1843b5f9.jpg
.
Please tell me what else needs to be done to migrate files?