Shrineで画像の入れ替え
解決
class User < ApplicationRecord
include ImageUploader::Attachment.new(:icon_image)
end
image_io = URI.parse("https://path/to/image.jpg").open
image_uri.basename # filename
image_io.size # file size
MIME::Types.type_for(image_uri.to_s).first.content_type # extentions
user.icon_image.replace(image_io)
note
replaceではエンドポイント(アクセスURL)を変えずに、画像のみ変える。