目标是将附件下载到 tempdir 以供后续使用。 The documentation说使用ActiveStorage::Blob#open
这似乎很简单。
我遇到了错误,所以请解释我做错了什么:
@flower.photo.open
结果 NoMethodError (private method 'open' called for #<ActiveStorage::Attached::One:0x00007f9780625100>)
NoMethodError (private method 'open' called for #<ActiveStorage::Blob:0x00007f9780615c50>)
检查 the source code我不确定为什么会收到私有(private)方法错误。
最佳答案
该方法直到明年 Rails 6 才发布。
有一个similar SO question here提供更多信息和建议。
关于ruby-on-rails - 如何将 ActiveStorage 附件下载到 tmpdir,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50879982/