Does anyone know how to change the disk_service.rb to specify upload paths, for example:
my_path = Rails.root.join("public", "websites", "example.com", "users", current_user.id, "avatar")
current_user.avatar.attach(file, my_path)
This would result in having the file uploaded here:
/public/websites/example.com/users/12345/avatar/blah.png
And then I'd be able to:
rails_representation_path( current_user.avatar.variant(resize: "100x100"), disposition: 'attachment')
and get back the path:
/websites/example.com/users/12345/avatar/blah-100x100.png
This will allow getting rid of many issues around the ActiveStorage public/private URLs and related to CDN caching.
I am playing with https://github.com/rails/rails/blob/master/activestorage/lib/active_storage/service/disk_service.rb but can't figure out much of what it does and how it works really.