From 8b44687e9e12191964c0f4078d8b6552e3cc9b87 Mon Sep 17 00:00:00 2001 From: Gaurish Sharma Date: Sat, 12 Mar 2016 13:33:08 +0530 Subject: Add example for ActionController::Parameters#to_unsafe_h [ci-skip] --- actionpack/lib/action_controller/metal/strong_parameters.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb index a01110d474..bb7ec97e9e 100644 --- a/actionpack/lib/action_controller/metal/strong_parameters.rb +++ b/actionpack/lib/action_controller/metal/strong_parameters.rb @@ -184,6 +184,13 @@ module ActionController # Returns an unsafe, unfiltered # ActiveSupport::HashWithIndifferentAccess representation of this # parameter. + # + # params = ActionController::Parameters.new({ + # name: 'Senjougahara Hitagi', + # oddity: 'Heavy stone crab' + # }) + # params.to_unsafe_h + # # => {"name"=>"Senjougahara Hitagi", oddity" => "Heavy stone crab"} def to_unsafe_h convert_parameters_to_hashes(@parameters, :to_unsafe_h) end -- cgit v1.2.3 From 91eeefc7953672de5923389308266a1744f3b176 Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Thu, 24 Mar 2016 20:58:42 +0530 Subject: [ci skip] Fix example of ActionController::Parameters#to_unsafe_h - Added missing `"`. --- actionpack/lib/action_controller/metal/strong_parameters.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb index bb7ec97e9e..9d20cf21ab 100644 --- a/actionpack/lib/action_controller/metal/strong_parameters.rb +++ b/actionpack/lib/action_controller/metal/strong_parameters.rb @@ -190,7 +190,7 @@ module ActionController # oddity: 'Heavy stone crab' # }) # params.to_unsafe_h - # # => {"name"=>"Senjougahara Hitagi", oddity" => "Heavy stone crab"} + # # => {"name"=>"Senjougahara Hitagi", "oddity" => "Heavy stone crab"} def to_unsafe_h convert_parameters_to_hashes(@parameters, :to_unsafe_h) end -- cgit v1.2.3