diff options
author | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-11-30 11:24:16 -0500 |
---|---|---|
committer | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-11-30 11:24:16 -0500 |
commit | 83482256efec140b53adde50ba8263af6af7a016 (patch) | |
tree | 38ac54edca8c8f450d272b034e90d39c4eb387c3 /actionpack/lib/action_controller/metal | |
parent | 64c53d7ce40006bdfea59102bdac4cb265d3ecd1 (diff) | |
download | rails-83482256efec140b53adde50ba8263af6af7a016.tar.gz rails-83482256efec140b53adde50ba8263af6af7a016.tar.bz2 rails-83482256efec140b53adde50ba8263af6af7a016.zip |
hash filters should be accessed with symbols or strings
Diffstat (limited to 'actionpack/lib/action_controller/metal')
-rw-r--r-- | actionpack/lib/action_controller/metal/strong_parameters.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb index 99a4e312cf..386075bd30 100644 --- a/actionpack/lib/action_controller/metal/strong_parameters.rb +++ b/actionpack/lib/action_controller/metal/strong_parameters.rb @@ -124,10 +124,10 @@ module ActionController # <tt>ActionController::ParameterMissing</tt> error. # # ActionController::Parameters.new(person: { name: 'Francesco' }).require(:person) - # # => {"name"=>"Francesco"} + # # => {"name"=>"Francesco"} # # ActionController::Parameters.new(person: nil).require(:person) - # # => ActionController::ParameterMissing: param not found: person + # # => ActionController::ParameterMissing: param not found: person # # ActionController::Parameters.new(person: {}).require(:person) # # => ActionController::ParameterMissing: param not found: person @@ -187,7 +187,7 @@ module ActionController # # => {} # # params.require(:person).permit(contact: :phone) - # # => {"contact"=>{"phone"=>"555-1234"}} + # # => {"contact"=>{"phone"=>"555-1234"}} # # params.require(:person).permit(contact: [ :email, :phone ]) # # => {"contact"=>{"email"=>"none@test.com", "phone"=>"555-1234"}} @@ -203,6 +203,8 @@ module ActionController end keys.grep(/\A#{Regexp.escape(filter)}\(\d+[if]?\)\z/) { |key| params[key] = self[key] } when Hash then + filter = filter.with_indifferent_access + self.slice(*filter.keys).each do |key, values| return unless values |