diff --git a/actionpack/lib/action_controller/metal/params_wrapper.rb b/actionpack/lib/action_controller/metal/params_wrapper.rb index dfc4e3d72ca59bdecfcdff2cbb2a682adeb27ac8..2d8afc3a7830acda9371e60b4d5e89deee993954 100644 --- a/actionpack/lib/action_controller/metal/params_wrapper.rb +++ b/actionpack/lib/action_controller/metal/params_wrapper.rb @@ -121,8 +121,6 @@ def wrap_parameters(name_or_model_or_options, options = {}) _set_wrapper_defaults(_wrapper_options.slice(:format).merge(options), model) end - alias :wrap_parameters= :wrap_parameters - # Sets the default wrapper key or model which will be used to determine # wrapper key and attribute names. Will be called automatically when the # module is inherited. diff --git a/actionpack/test/controller/params_wrapper_test.rb b/actionpack/test/controller/params_wrapper_test.rb index e1914cf8949080be3cceca816c53bf64e6ce6f7c..7bef1e8d5df4b995a161a889e8392afe964ce86c 100644 --- a/actionpack/test/controller/params_wrapper_test.rb +++ b/actionpack/test/controller/params_wrapper_test.rb @@ -180,13 +180,6 @@ def test_not_wrapping_abstract_model assert_parameters({ 'username' => 'sikachu', 'title' => 'Developer', 'user' => { 'username' => 'sikachu', 'title' => 'Developer' }}) end end - - def test_assignment_alias - with_default_wrapper_options do - UsersController.wrap_parameters = { :format => [:foo] } - assert_equal({ :format => [:foo], :name => "user" }, UsersController._wrapper_options) - end - end end class NamespacedParamsWrapperTest < ActionController::TestCase diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt index b7b344a62d85557025eb9df9ccdc88cd3b5e3658..d640f578da6e086105cbb66afd9b7a72fe3c046f 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt @@ -3,12 +3,14 @@ # This file contains settings for ActionController::ParamsWrapper which # is enabled by default. -<%= app_const %>.configure do - # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. - config.action_controller.wrap_parameters = { <%= key_value :format, "[:json]" %> } +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters <%= key_value :format, "[:json]" %> +end - <%- unless options.skip_active_record? -%> - # Disable root element in JSON by default. - config.active_record.include_root_in_json = false - <%- end -%> +<%- unless options.skip_active_record? -%> +# Disable root element in JSON by default. +ActiveSupport.on_load(:active_record) do + self.include_root_in_json = false end +<%- end -%>