From d123a8c69daabcd1eba2f0467491c1b04bdb2356 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Fri, 19 Apr 2024 00:54:54 +0300 Subject: [PATCH] ActiveStorage configuration --- config/initializers/active_storage.rb | 1 + config/initializers/new_framework_defaults_6_0.rb | 2 +- config/initializers/new_framework_defaults_6_1.rb | 6 +++--- config/initializers/new_framework_defaults_7_0.rb | 8 ++++---- 4 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 config/initializers/active_storage.rb diff --git a/config/initializers/active_storage.rb b/config/initializers/active_storage.rb new file mode 100644 index 0000000..f2923d0 --- /dev/null +++ b/config/initializers/active_storage.rb @@ -0,0 +1 @@ +Rails.application.config.active_storage.resolve_model_to_route = :rails_storage_proxy diff --git a/config/initializers/new_framework_defaults_6_0.rb b/config/initializers/new_framework_defaults_6_0.rb index 92240ef..004385f 100644 --- a/config/initializers/new_framework_defaults_6_0.rb +++ b/config/initializers/new_framework_defaults_6_0.rb @@ -28,7 +28,7 @@ # When assigning to a collection of attachments declared via `has_many_attached`, replace existing # attachments instead of appending. Use #attach to add new attachments without replacing existing ones. -# Rails.application.config.active_storage.replace_on_assign_to_many = true +Rails.application.config.active_storage.replace_on_assign_to_many = true # Use ActionMailer::MailDeliveryJob for sending parameterized and normal mail. # diff --git a/config/initializers/new_framework_defaults_6_1.rb b/config/initializers/new_framework_defaults_6_1.rb index 9526b83..9e5b0c3 100644 --- a/config/initializers/new_framework_defaults_6_1.rb +++ b/config/initializers/new_framework_defaults_6_1.rb @@ -10,7 +10,7 @@ # Rails.application.config.active_record.has_many_inversing = true # Track Active Storage variants in the database. -# Rails.application.config.active_storage.track_variants = true +Rails.application.config.active_storage.track_variants = true # Apply random variation to the delay when retrying failed jobs. # Rails.application.config.active_job.retry_jitter = 0.15 @@ -48,10 +48,10 @@ # Rails.application.config.action_view.form_with_generates_remote_forms = false # Set the default queue name for the analysis job to the queue adapter default. -# Rails.application.config.active_storage.queues.analysis = nil +Rails.application.config.active_storage.queues.analysis = nil # Set the default queue name for the purge job to the queue adapter default. -# Rails.application.config.active_storage.queues.purge = nil +Rails.application.config.active_storage.queues.purge = nil # Set the default queue name for the incineration job to the queue adapter default. # Rails.application.config.action_mailbox.queues.incineration = nil diff --git a/config/initializers/new_framework_defaults_7_0.rb b/config/initializers/new_framework_defaults_7_0.rb index b13ef5e..491f88b 100644 --- a/config/initializers/new_framework_defaults_7_0.rb +++ b/config/initializers/new_framework_defaults_7_0.rb @@ -46,8 +46,8 @@ # The ActiveStorage video previewer will now use scene change detection to generate # better preview images (rather than the previous default of using the first frame # of the video). -# Rails.application.config.active_storage.video_preview_arguments = -# "-vf 'select=eq(n\\,0)+eq(key\\,1)+gt(scene\\,0.015),loop=loop=-1:size=2,trim=start_frame=1' -frames:v 1 -f image2" +Rails.application.config.active_storage.video_preview_arguments = + "-vf 'select=eq(n\\,0)+eq(key\\,1)+gt(scene\\,0.015),loop=loop=-1:size=2,trim=start_frame=1' -frames:v 1 -f image2" # Automatically infer `inverse_of` for associations with a scope. # Rails.application.config.active_record.automatic_scope_inversing = true @@ -68,7 +68,7 @@ # generate variants to use image processing macros and ruby-vips # operations. See the upgrading guide for detail on the changes required. # The `:mini_magick` option is not deprecated; it's fine to keep using it. -# Rails.application.config.active_storage.variant_processor = :vips +Rails.application.config.active_storage.variant_processor = :vips # Enable parameter wrapping for JSON. # Previously this was set in an initializer. It's fine to keep using that initializer if you've customized it. @@ -135,7 +135,7 @@ # Active Storage `has_many_attached` relationships will default to replacing the current collection instead of appending to it. # Thus, to support submitting an empty collection, the `file_field` helper will render an hidden field `include_hidden` by default when `multiple_file_field_include_hidden` is set to `true`. # See https://guides.rubyonrails.org/configuring.html#config-active-storage-multiple-file-field-include-hidden for more information. -# Rails.application.config.active_storage.multiple_file_field_include_hidden = true +Rails.application.config.active_storage.multiple_file_field_include_hidden = true # ** Please read carefully, this must be configured in config/application.rb (NOT this file) ** # Disables the deprecated #to_s override in some Ruby core classes