ActiveStorage: use public url?
I'm using Cloudinary as an ActiveStorage store for ActionText in Rails 6.1, cloudinary gem v1.28. Instead of the local signed URL I'd like to have it use the direct URL to Cloudinary. In the ActiveStorage documentation, there is the concept of setting a public flag in storage.yml:
cloudinary: service: Cloudinary public: true
but I'm still receiving the 'localhost' link in dev. Does the Cloudinary gem allow for that configuration?
Answers
-
Hi @mccollek,
Could you please confirm what method you're calling to generate the URL which is pointing to localhost (e.g.
url_for
helper orBlob#url
/#Blob#service_url
)?By default, assets uploaded to Cloudinary will be public (
type: upload
) unless you set a differenttype
and/or use other features to restrict access, such as Access Control.Blob#service_url
nowBlob#url
in Rails 6.1+ would give you the direct URL to the asset on Cloudinary. If the asset requires authentication (e.g. Signed URL or Token for Access Control) then you'll want to use the dedicated methods via the Cloudinary SDK such ascloudinary_url
/cl_image_tag
) which support generating those.0