【发布时间】:2026-02-17 22:25:01
【问题描述】:
我想将图像附加到 rake 任务中的记录。我唯一的图像是 URL。这是图片的 URL https://cdn.iconscout.com/icon/free/png-256/google-analytics-7-722699.png。
我在 * answer 中使用了这种方法。
require 'open-uri'
downloaded_file = open(tool.image)
new_tool.image.attach(io: downloaded_file, filename: "foo.png")
这会产生以下错误。
ActiveStorage::IntegrityError: Unsupported source URL: #<StringIO:0x00007f9bd9759f28>
Caused by:
CloudinaryException: Unsupported source URL: #<StringIO:0x00007f9bd9759f28>
有人可以帮我吗?
【问题讨论】:
标签: ruby-on-rails cloudinary rails-activestorage