Files
fizzy/config/initializers/tenanting/active_storage.rb
T
Mike Dalessio 05984845ca Change Active Storage account slug extension to a to_prepare block
because it was breaking in development after a reload.
2025-07-03 19:01:03 -04:00

20 lines
515 B
Ruby

module ActiveStorageControllerExtensions
extend ActiveSupport::Concern
included do
before_action do
# Add script_name so that Disk Service will generate correct URLs for uploads
ActiveStorage::Current.url_options = {
protocol: request.protocol,
host: request.host,
port: request.port,
script_name: request.script_name
}
end
end
end
Rails.application.config.to_prepare do
ActiveStorage::BaseController.include ActiveStorageControllerExtensions
end