相关疑难解决方法(0)

将活动存储附件下载到光盘

该指南说我可以保存光盘附件以在其上运行一个过程,如下所示:

message.video.open do |file|
  system '/path/to/virus/scanner', file.path
  # ...
end
Run Code Online (Sandbox Code Playgroud)

我的模型的附件定义为:

has_one_attached :zip
Run Code Online (Sandbox Code Playgroud)

然后在我定义的模型中:

def process_zip      
  zip.open do |file|
    # process the zip file
  end
end
Run Code Online (Sandbox Code Playgroud)

但是我收到一个错误:

private method `open' called
Run Code Online (Sandbox Code Playgroud)

在zip.open调用.

如何在本地保存zip以进行处理?

ruby-on-rails rails-activestorage

8
推荐指数
2
解决办法
2166
查看次数

标签 统计

rails-activestorage ×1

ruby-on-rails ×1