diff options
author | Alberto Almagro <alberto.almagro@rakuten.com> | 2017-08-03 22:20:52 +0200 |
---|---|---|
committer | Alberto Almagro <alberto.almagro@rakuten.com> | 2017-08-14 23:56:13 +0200 |
commit | 7fade3dcbcfc1f5ba6c455c04f04040f077e0d70 (patch) | |
tree | c96468d7917bcf00c578af678c6f43f3037f5ab0 /actionpack/lib | |
parent | 10bf93ef92a70ae511036134290bf0e2de184b5c (diff) | |
download | rails-7fade3dcbcfc1f5ba6c455c04f04040f077e0d70.tar.gz rails-7fade3dcbcfc1f5ba6c455c04f04040f077e0d70.tar.bz2 rails-7fade3dcbcfc1f5ba6c455c04f04040f077e0d70.zip |
Load Parameters configurations on :action_controller only once
Fixes regression ActionController::UnpermittedParameters not raised. The inner hook was being executed twice, once when ActionController::Base was loaded and again when ActionController::API was loaded. As options.delete operations inside the block are not idempotent, the second time it was run there was no configuration option available
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/railtie.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/railtie.rb b/actionpack/lib/action_controller/railtie.rb index cc02c9a53a..769be39004 100644 --- a/actionpack/lib/action_controller/railtie.rb +++ b/actionpack/lib/action_controller/railtie.rb @@ -24,7 +24,7 @@ module ActionController initializer "action_controller.parameters_config" do |app| options = app.config.action_controller - ActiveSupport.on_load(:action_controller) do + ActiveSupport.on_load(:action_controller, run_once: true) 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 = |