【发布时间】:2018-11-08 15:28:21
【问题描述】:
我一直在 Rails 5.2 上实施 Active Storage Google 策略,目前我可以毫无问题地使用 rails 控制台上传文件,我唯一缺少的是是否有办法在其中指定目录一个桶。现在我上传如下
bk.file.attach(io: File.open(bk.source_dir.to_s), filename: "file.tar.gz", content_type: "application/x-tar")
我的 storage.yml 上的配置
google:
service: GCS
project: my-project
credentials: <%= Rails.root.join("config/myfile.json") %>
bucket: bucketname
但在我的存储桶中有不同的目录,例如存储桶名称/部门 1 等。我浏览了文档,但没有找到指定更多目录的方法,我所有的上传都以存储桶名称结尾。
【问题讨论】:
-
@George Claghorn 我会接受你的回答,希望这可以在未来的版本中得到解决。谢谢。
标签: ruby-on-rails google-cloud-storage rails-activestorage