diff options
author | Kir Shatrov <shatrov@me.com> | 2016-08-30 11:51:19 -0400 |
---|---|---|
committer | Kir Shatrov <shatrov@me.com> | 2016-08-31 10:17:55 -0400 |
commit | f1e86a051f5f170c3ab8153f7875269c3395d34b (patch) | |
tree | e2aef5dfcd8bba480c4a10df9e8d8d813b851582 /actionpack | |
parent | 3132fa6b7d9585e04eb44b25b55d298391b040b5 (diff) | |
download | rails-f1e86a051f5f170c3ab8153f7875269c3395d34b.tar.gz rails-f1e86a051f5f170c3ab8153f7875269c3395d34b.tar.bz2 rails-f1e86a051f5f170c3ab8153f7875269c3395d34b.zip |
Do not allow to_param on AC::Parameters
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/metal/strong_parameters.rb | 3 | ||||
-rw-r--r-- | actionpack/test/controller/required_params_test.rb | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb index d62e01d185..f315d93939 100644 --- a/actionpack/lib/action_controller/metal/strong_parameters.rb +++ b/actionpack/lib/action_controller/metal/strong_parameters.rb @@ -2,6 +2,7 @@ require "active_support/core_ext/hash/indifferent_access" require "active_support/core_ext/hash/transform_values" require "active_support/core_ext/array/wrap" require "active_support/core_ext/string/filters" +require "active_support/core_ext/object/to_query" require "active_support/rescuable" require "action_dispatch/http/upload" require "rack/test" @@ -410,6 +411,8 @@ module ActionController convert_hashes_to_parameters(key, @parameters[key]) end + undef_method :to_param + # Assigns a value to a given +key+. The given key may still get filtered out # when +permit+ is called. def []=(key, value) diff --git a/actionpack/test/controller/required_params_test.rb b/actionpack/test/controller/required_params_test.rb index 315d1ff3e8..9fa2b6dbb0 100644 --- a/actionpack/test/controller/required_params_test.rb +++ b/actionpack/test/controller/required_params_test.rb @@ -77,4 +77,10 @@ class ParametersRequireTest < ActiveSupport::TestCase ActionController::Parameters.new(foo: "bar").merge!(bar: "foo") end end + + test "to_query is not supported" do + assert_deprecated do + ActionController::Parameters.new(foo: "bar").to_param + end + end end |