从Google Cloud Storage上载的文件中获取文件路径

我刚刚将应用程序配置为使用Google Cloud Storage来存储用户上传的内容。到目前为止,我可以通过以下方式检索上载的文件路径:

activeStorage::Blob.service.send(:path_for,file.key)

但是,在Google Cloud Storage上,这给了我以下错误:

NoMethodError (undefined method `path_for' for #<activeStorage::Service::GCSService:...>)

如何在此处检索文件路径?

qq975120043 回答:从Google Cloud Storage上载的文件中获取文件路径

您可以使用url_for_direct_upload(key,expires_in:,checksum:,**)url(key,filename:,content_type:,disposition:)来获取GCS网址。

Reference

本文链接:https://www.f2er.com/3035734.html

大家都在问