使用Active Storage播种远程映像?

时间:2019-05-15 19:18:57

标签: ruby-on-rails seed rails-activestorage

我正在尝试使用没有任何gem的Active Storage播种图像:

require 'uri'

 @poi= Poi.find(1)
 upload = "https://unsplash.com/photos/1ZT5j_yd0P4"
 file = URI.open(upload)
 @poi.photos.attach(io: file, filename: "#{@poi.id}-#{@poi.name.downcase.parameterize}.jpg")

我得到一个错误:

ActiveSupport :: MessageEncryptor :: InvalidMessage:ActiveSupport :: MessageEncryptor :: InvalidMessage

原因: OpenSSL :: Cipher :: CipherError:

0 个答案:

没有答案