From 28f648dbc7e1523295a89b670db30c4542b8fb5a Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Wed, 30 Dec 2015 19:50:25 +0530 Subject: Fix AC::Parameters#to_unsafe_h to return all unfiltered values - AC::Parameters#convert_parameters_to_hashes should return filtered or unfiltered values based on whether it is called from `to_h` or `to_unsafe_h` instead of always defaulting to `to_h`. - Fixes #22841 --- actionpack/test/controller/parameters/parameters_permit_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/controller/parameters/parameters_permit_test.rb b/actionpack/test/controller/parameters/parameters_permit_test.rb index fb72fca789..9a79784ec7 100644 --- a/actionpack/test/controller/parameters/parameters_permit_test.rb +++ b/actionpack/test/controller/parameters/parameters_permit_test.rb @@ -298,6 +298,14 @@ class ParametersPermitTest < ActiveSupport::TestCase assert_not @params.to_h.is_a? ActionController::Parameters end + test "to_unsafe_h returns unfiltered params even after accessing few keys" do + params = ActionController::Parameters.new("f"=>{"language_facet"=>["Tibetan"]}) + expected = {"f"=>{"language_facet"=>["Tibetan"]}} + + assert params['f'].is_a? ActionController::Parameters + assert_equal expected, params.to_unsafe_h + end + test "to_h only deep dups Ruby collections" do company = Class.new do attr_reader :dupped -- cgit v1.2.3