Files
docuseal/config/initializers/active_storage.rb
T

29 lines
725 B
Ruby
Raw Normal View History

2023-05-21 17:59:36 +03:00
# frozen_string_literal: true
ActiveSupport.on_load(:active_storage_attachment) do
attribute :uuid, :string, default: -> { SecureRandom.uuid }
has_many_attached :preview_images
end
2023-06-24 22:50:12 +03:00
ActiveStorage::LogSubscriber.detach_from(:active_storage) if Rails.env.production?
2023-05-21 17:59:36 +03:00
Rails.configuration.to_prepare do
ActiveStorage::DiskController.after_action do
response.set_header('Cache-Control', 'public, max-age=31536000') if action_name == 'show'
end
2023-06-24 12:27:34 +03:00
ActiveStorage::DirectUploadsController.before_action do
next if current_user
next if Submitter.find_signed(cookies.signed[:submitter_sid])
head :forbidden
end
2023-05-21 17:59:36 +03:00
LoadActiveStorageConfigs.call
2023-06-09 01:43:43 +03:00
rescue StandardError => e
2023-06-13 00:29:07 +03:00
Rails.logger.error(e)
2023-06-09 01:43:43 +03:00
2023-05-21 17:59:36 +03:00
nil
end