Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix autoloading deprecation warnings from Rails 6 #16010

Merged
merged 1 commit into from
Apr 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 8 additions & 6 deletions config/initializers/content_security_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ def host_to_url(str)

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
4 changes: 3 additions & 1 deletion config/initializers/paperclip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@
)
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:
Expand Down
4 changes: 3 additions & 1 deletion config/initializers/suppress_csrf_warnings.rb
Original file line number Diff line number Diff line change
@@ -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