adjust for custom domain

This commit is contained in:
Pete Matsyburka
2026-02-19 15:54:15 +02:00
parent 739e2abdf8
commit 825322d489
12 changed files with 48 additions and 31 deletions
+8
View File
@@ -10,6 +10,7 @@ ActiveSupport.on_load(:active_storage_attachment) do
end
end
# rubocop:disable Metrics/BlockLength
ActiveSupport.on_load(:active_storage_blob) do
attribute :uuid, :string, default: -> { SecureRandom.uuid }
attribute :io_data, :string, default: ''
@@ -22,6 +23,12 @@ ActiveSupport.on_load(:active_storage_blob) do
)
end
def self.proxy_path(blob, expires_at: nil, filename: nil)
Rails.application.routes.url_helpers.blobs_proxy_path(
signed_uuid: blob.signed_uuid(expires_at:), filename: filename || blob.filename
)
end
def uuid
super || begin
new_uuid = SecureRandom.uuid
@@ -40,6 +47,7 @@ ActiveSupport.on_load(:active_storage_blob) do
service.delete(key)
end
end
# rubocop:enable Metrics/BlockLength
ActiveStorage::LogSubscriber.detach_from(:active_storage) if Rails.env.production?