diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2017-07-04 15:32:26 -0400 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2017-07-04 15:35:37 -0400 |
commit | 4c8332c2963a33cef5d75fdcaabb65b8947fbfcd (patch) | |
tree | 6d865a53ba1e0512f4e552d4d44d944e1cf6d9c2 /actionpack/lib | |
parent | 2975aeb8884fd1cddd6d4ed016f3adfdcc7c6774 (diff) | |
download | rails-4c8332c2963a33cef5d75fdcaabb65b8947fbfcd.tar.gz rails-4c8332c2963a33cef5d75fdcaabb65b8947fbfcd.tar.bz2 rails-4c8332c2963a33cef5d75fdcaabb65b8947fbfcd.zip |
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.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/railtie.rb | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/actionpack/lib/action_controller/railtie.rb b/actionpack/lib/action_controller/railtie.rb index 054fe9e396..eab0f11c52 100644 --- a/actionpack/lib/action_controller/railtie.rb +++ b/actionpack/lib/action_controller/railtie.rb @@ -22,13 +22,14 @@ module ActionController initializer "action_controller.parameters_config" do |app| options = app.config.action_controller - ActionController::Parameters.permit_all_parameters = options.delete(: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) - end - ActionController::Parameters.action_on_unpermitted_parameters = options.delete(:action_on_unpermitted_parameters) do - (Rails.env.test? || Rails.env.development?) ? :log : false + ActiveSupport.on_load(:action_controller) do + ActionController::Parameters.permit_all_parameters = options.delete(: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) + end + ActionController::Parameters.action_on_unpermitted_parameters = options.delete(:action_on_unpermitted_parameters) do + (Rails.env.test? || Rails.env.development?) ? :log : false end end |