Skip to content

Commit

Permalink
Do not allow to_param on AC::Parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
kirs committed Aug 31, 2016
1 parent 3132fa6 commit f1e86a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions actionpack/lib/action_controller/metal/strong_parameters.rb
Expand Up @@ -2,6 +2,7 @@
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"
Expand Down Expand Up @@ -410,6 +411,8 @@ def [](key)
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)
Expand Down
6 changes: 6 additions & 0 deletions actionpack/test/controller/required_params_test.rb
Expand Up @@ -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

0 comments on commit f1e86a0

Please sign in to comment.