如何将ActiveStorage附件下载到tmpdir

时间:2018-06-15 17:07:13

标签: ruby-on-rails rails-activestorage

目标是将附件下载到tempdir以供后续使用。 The documentation说要使用ActiveStorage::Blob#open这看起来很简单。

我收到错误,请解释我的错误:

  1. 致电@flower.photo.open会导致NoMethodError (private method 'open' called for #<ActiveStorage::Attached::One:0x00007f9780625100>)
  2. 致电@ flower.photo.blob.open`会产生NoMethodError (private method 'open' called for #<ActiveStorage::Blob:0x00007f9780615c50>)
  3. 检查the source code我不知道为什么我收到私有方法错误。

1 个答案:

答案 0 :(得分:3)

这种方法直到明年的第6轨才被释放。

有一个similar SO question here,其中包含更多信息和建议。