1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Load the Parameters configurations on the right time

We need to configure it only when ActionController::Base is loaded
otherwise configs on initializers will not work.

Closes #29527.
This commit is contained in:
Rafael Mendonça França 2017-07-04 15:32:26 -04:00
parent 2975aeb888
commit 4c8332c296

View file

@ -22,13 +22,14 @@ module ActionController
initializer "action_controller.parameters_config" do |app| initializer "action_controller.parameters_config" do |app|
options = app.config.action_controller options = app.config.action_controller
ActionController::Parameters.permit_all_parameters = options.delete(:permit_all_parameters) { false } ActiveSupport.on_load(:action_controller) do
if app.config.action_controller[:always_permitted_parameters] ActionController::Parameters.permit_all_parameters = options.delete(:permit_all_parameters) { false }
ActionController::Parameters.always_permitted_parameters = if app.config.action_controller[:always_permitted_parameters]
app.config.action_controller.delete(:always_permitted_parameters) ActionController::Parameters.always_permitted_parameters =
end app.config.action_controller.delete(:always_permitted_parameters)
ActionController::Parameters.action_on_unpermitted_parameters = options.delete(:action_on_unpermitted_parameters) do end
(Rails.env.test? || Rails.env.development?) ? :log : false ActionController::Parameters.action_on_unpermitted_parameters = options.delete(:action_on_unpermitted_parameters) do
(Rails.env.test? || Rails.env.development?) ? :log : false
end end
end end