`cl_image_tag` and `cloudinary_url` ignores model class `ActiveStorage` service configuration
Describe the bug in a sentence or two.
I have different ActiveStorage configuration with different folders to organize a little bit my images. The problem is that the SDK it's only getting the service from the global application configuration and not from the model class when present.
Issue Type (Can be multiple)
- [ ] Build - Cannot install or import the SDK
- [ ] Performance - Performance issues
- [X] Behaviour - Functions are not working as expected (such as generate URL)
- [ ] Documentation - Inconsistency between the docs and behaviour
- [ ] Other (Specify)
Steps to reproduce
local:
service: Disk
root: <%= Rails.root.join("storage") %>
cloudinary_brands:
service: Cloudinary
cloud_name: <%= ENV.fetch("CLOUDINARY_CLOUD_NAME") %>
api_key: <%= ENV.fetch("CLOUDINARY_API_KEY") %>
api_secret: <%= ENV.fetch("CLOUDINARY_API_SECRET") %>
folder: <%= Rails.env + '/brands' %>
secure: true
class Brand < ApplicationRecord
has_one_attached :logo, service: :cloudinary_brands
end
config.active_storage.service = :local # If I set this to :cloudinary_brands the URLs are properly generated
Error screenshots or Stack Trace (if applicable)
…
Operating System
- [ ] Linux
- [ ] Windows
- [ ] macOS
- [X] All
Environment and Libraries (fill in the version numbers)
- Cloudinary Ruby SDK version - 2.1.2
- Ruby Version - 3.3.4
- Rails Version - 7.2
Repository
If possible, please provide a link to a reproducible repository that showcases the problem
@enrique-fernandez-polo so per your comment you need to set config.active_storage.service to :cloudinary_brands and this way the SDK will generate the proper Cloudinary URLs.
This is also mentioned in Active Storage configuration
Let me know if this answers your question.
Hello there!
I have six different configurations, I can not set the value there. I want everything to be uploaded by default using a service called local and use other more specific services for some cases.
For example I have cloudinary_brands and cloudinary_pictures each with different configurations.
@enrique-fernandez-polo This isn't currently supported, but I've opened a feature request. I don't have an approximate expected time that this would completed but we'll be sure to update you just as soon as it has.
In the meantime we will look into a workaround.