前提・実現したいこと
Active Storage機能で、S3にファイルのアップロードは出来ました。
このファイルのs3ドメインをcloudfrontに変更したいのですが、どこを設定すればよいのでしょうか?
現状
viewファイルでは、
/ image.html.slim = image_tag(url_for(@user.image_avatar.variant(resize: "400x400")), class: 'img-thumbnail')
HTMLの出力は、
<!-- HTMLでは --> <img class="img-thumbnail" src="/rails/active_storage/representations/eyJfcm〜IMG_20180529_152734.jpg">
↑こちらはリンク先にアクセスすると、Active Storageのアップロード先であるS3のファイルにアクセス(リダイレクト)できています。
ちなみに、 storage.yml
は、下記のような設定にしています。
test: service: Disk root: <%= Rails.root.join("tmp/storage") %> local: service: Disk root: <%= Rails.root.join("storage") %> development: service: S3 access_key_id: 'xxxxx' secret_access_key: 'xxxxx' region: 'xxxxx' bucket: 'xxxxx'
あなたの回答
tips
プレビュー