mirror of https://github.com/rails/rails
Stop relying on mutating the configuration object
This commit is contained in:
parent
8af78700d2
commit
a6aa9376f1
|
@ -27,16 +27,15 @@ module ActionController
|
|||
options = app.config.action_controller
|
||||
|
||||
ActiveSupport.on_load(:action_controller, run_once: true) do
|
||||
ActionController::Parameters.permit_all_parameters = options.delete(:permit_all_parameters) { false }
|
||||
ActionController::Parameters.permit_all_parameters = options.permit_all_parameters || false
|
||||
if app.config.action_controller[:always_permitted_parameters]
|
||||
ActionController::Parameters.always_permitted_parameters =
|
||||
app.config.action_controller.delete(:always_permitted_parameters)
|
||||
app.config.action_controller.always_permitted_parameters
|
||||
end
|
||||
ActionController::Parameters.action_on_unpermitted_parameters = options.delete(:action_on_unpermitted_parameters) do
|
||||
ActionController::Parameters.action_on_unpermitted_parameters = options.action_on_unpermitted_parameters ||
|
||||
(Rails.env.test? || Rails.env.development?) ? :log : false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
initializer "action_controller.set_configs" do |app|
|
||||
paths = app.config.paths
|
||||
|
@ -53,7 +52,12 @@ module ActionController
|
|||
options.relative_url_root ||= app.config.relative_url_root
|
||||
|
||||
# Configs used in other initializers
|
||||
options = options.except(:log_query_tags_around_actions)
|
||||
options = options.except(
|
||||
:log_query_tags_around_actions,
|
||||
:permit_all_parameters,
|
||||
:action_on_unpermitted_parameters,
|
||||
:always_permitted_parameters
|
||||
)
|
||||
|
||||
ActiveSupport.on_load(:action_controller) do
|
||||
include app.routes.mounted_helpers
|
||||
|
|
|
@ -16,7 +16,7 @@ module ActiveJob
|
|||
|
||||
initializer "active_job.custom_serializers" do |app|
|
||||
config.after_initialize do
|
||||
custom_serializers = app.config.active_job.delete(:custom_serializers)
|
||||
custom_serializers = app.config.active_job.custom_serializers
|
||||
ActiveJob::Serializers.add_serializers custom_serializers
|
||||
end
|
||||
end
|
||||
|
@ -26,7 +26,10 @@ module ActiveJob
|
|||
options.queue_adapter ||= :async
|
||||
|
||||
# Configs used in other initializers
|
||||
options = options.except(:log_query_tags_around_perform)
|
||||
options = options.except(
|
||||
:log_query_tags_around_perform,
|
||||
:custom_serializers
|
||||
)
|
||||
|
||||
ActiveSupport.on_load(:active_job) do
|
||||
options.each do |k, v|
|
||||
|
|
Loading…
Reference in New Issue