Browse Source

Fix autoloading deprecation warnings from Rails 6 (#16010)

closed-social-v3
Eugen Rochko 3 years ago
committed by GitHub
parent
commit
3f2533ca8e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 8 deletions
  1. +8
    -6
      config/initializers/content_security_policy.rb
  2. +3
    -1
      config/initializers/paperclip.rb
  3. +3
    -1
      config/initializers/suppress_csrf_warnings.rb

+ 8
- 6
config/initializers/content_security_policy.rb View File

@ -51,11 +51,13 @@ Rails.application.config.content_security_policy_nonce_generator = -> request {
Rails.application.config.content_security_policy_nonce_directives = %w(style-src)
PgHero::HomeController.content_security_policy do |p|
p.script_src :self, :unsafe_inline, assets_host
p.style_src :self, :unsafe_inline, assets_host
end
Rails.application.reloader.to_prepare do
PgHero::HomeController.content_security_policy do |p|
p.script_src :self, :unsafe_inline, assets_host
p.style_src :self, :unsafe_inline, assets_host
end
PgHero::HomeController.after_action do
request.content_security_policy_nonce_generator = nil
PgHero::HomeController.after_action do
request.content_security_policy_nonce_generator = nil
end
end

+ 3
- 1
config/initializers/paperclip.rb View File

@ -112,7 +112,9 @@ else
)
end
Paperclip.options[:content_type_mappings] = { csv: Import::FILE_TYPES }
Rails.application.reloader.to_prepare do
Paperclip.options[:content_type_mappings] = { csv: Import::FILE_TYPES }
end
# In some places in the code, we rescue this exception, but we don't always
# load the S3 library, so it may be an undefined constant:

+ 3
- 1
config/initializers/suppress_csrf_warnings.rb View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
ActionController::Base.log_warning_on_csrf_failure = false
Rails.application.reloader.to_prepare do
ActionController::Base.log_warning_on_csrf_failure = false
end

Loading…
Cancel
Save