Skip to content

Commit a6aa937

Browse files
committed
Stop relying on mutating the configuration object
1 parent 8af7870 commit a6aa937

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

actionpack/lib/action_controller/railtie.rb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,13 @@ class Railtie < Rails::Railtie # :nodoc:
2727
options = app.config.action_controller
2828

2929
ActiveSupport.on_load(:action_controller, run_once: true) do
30-
ActionController::Parameters.permit_all_parameters = options.delete(:permit_all_parameters) { false }
30+
ActionController::Parameters.permit_all_parameters = options.permit_all_parameters || false
3131
if app.config.action_controller[:always_permitted_parameters]
3232
ActionController::Parameters.always_permitted_parameters =
33-
app.config.action_controller.delete(:always_permitted_parameters)
33+
app.config.action_controller.always_permitted_parameters
3434
end
35-
ActionController::Parameters.action_on_unpermitted_parameters = options.delete(:action_on_unpermitted_parameters) do
35+
ActionController::Parameters.action_on_unpermitted_parameters = options.action_on_unpermitted_parameters ||
3636
(Rails.env.test? || Rails.env.development?) ? :log : false
37-
end
3837
end
3938
end
4039

@@ -53,7 +52,12 @@ class Railtie < Rails::Railtie # :nodoc:
5352
options.relative_url_root ||= app.config.relative_url_root
5453

5554
# Configs used in other initializers
56-
options = options.except(:log_query_tags_around_actions)
55+
options = options.except(
56+
:log_query_tags_around_actions,
57+
:permit_all_parameters,
58+
:action_on_unpermitted_parameters,
59+
:always_permitted_parameters
60+
)
5761

5862
ActiveSupport.on_load(:action_controller) do
5963
include app.routes.mounted_helpers

activejob/lib/active_job/railtie.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Railtie < Rails::Railtie # :nodoc:
1616

1717
initializer "active_job.custom_serializers" do |app|
1818
config.after_initialize do
19-
custom_serializers = app.config.active_job.delete(:custom_serializers)
19+
custom_serializers = app.config.active_job.custom_serializers
2020
ActiveJob::Serializers.add_serializers custom_serializers
2121
end
2222
end
@@ -26,7 +26,10 @@ class Railtie < Rails::Railtie # :nodoc:
2626
options.queue_adapter ||= :async
2727

2828
# Configs used in other initializers
29-
options = options.except(:log_query_tags_around_perform)
29+
options = options.except(
30+
:log_query_tags_around_perform,
31+
:custom_serializers
32+
)
3033

3134
ActiveSupport.on_load(:active_job) do
3235
options.each do |k, v|

0 commit comments

Comments
 (0)