diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2021-04-09 02:31:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-09 02:31:20 +0200 |
commit | 3f2533ca8e2465fbc742df02741e7dbe633d0da0 (patch) | |
tree | e8c312a34e73a47add0d02888694c522e85dd782 | |
parent | ed7d459d7fedd1862897f99a75a0876b3a34a963 (diff) |
Fix autoloading deprecation warnings from Rails 6 (#16010)
-rw-r--r-- | config/initializers/content_security_policy.rb | 14 | ||||
-rw-r--r-- | config/initializers/paperclip.rb | 4 | ||||
-rw-r--r-- | config/initializers/suppress_csrf_warnings.rb | 4 |
3 files changed, 14 insertions, 8 deletions
diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 92645ff28..b377b7b4d 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -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 diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb index 9ad7fd814..e2a045647 100644 --- a/config/initializers/paperclip.rb +++ b/config/initializers/paperclip.rb @@ -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: diff --git a/config/initializers/suppress_csrf_warnings.rb b/config/initializers/suppress_csrf_warnings.rb index 410ab585b..b86adc6f1 100644 --- a/config/initializers/suppress_csrf_warnings.rb +++ b/config/initializers/suppress_csrf_warnings.rb @@ -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 |