[英]How to retrieve attachment url with Rails Active Storage with S3
[英]Rails attachment url replace s3 with subdomain off app domain
我有當前正在存儲在Amazon s3中的圖像,但是我希望附件url進入Rails域之外的新子域,而不是s3。 怎么做?
在圖像模型中,編寫一個方法,並在該方法中為url執行域替換邏輯。
假設您有一個attachment_url
:
def attachment_url
# implement the logic here
end
在控制器中獲取@image
,然后可以像這樣使用它
image_tag @image.attachment_url
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.