diff options
Diffstat (limited to 'actionpack/lib/action_controller/metal')
-rw-r--r-- | actionpack/lib/action_controller/metal/etag_with_template_digest.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/metal/strong_parameters.rb | 16 |
2 files changed, 10 insertions, 8 deletions
diff --git a/actionpack/lib/action_controller/metal/etag_with_template_digest.rb b/actionpack/lib/action_controller/metal/etag_with_template_digest.rb index 6c103bb042..798564db96 100644 --- a/actionpack/lib/action_controller/metal/etag_with_template_digest.rb +++ b/actionpack/lib/action_controller/metal/etag_with_template_digest.rb @@ -40,7 +40,7 @@ module ActionController end # Pick the template digest to include in the ETag. If the +:template+ option - # is present, use the named template. If +:template+ is nil or absent, use + # is present, use the named template. If +:template+ is +nil+ or absent, use # the default controller/action template. If +:template+ is false, omit the # template digest from the ETag. def pick_template_for_etag(options) diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb index 1977632c4e..e14da22e01 100644 --- a/actionpack/lib/action_controller/metal/strong_parameters.rb +++ b/actionpack/lib/action_controller/metal/strong_parameters.rb @@ -391,7 +391,7 @@ module ActionController case filter when Symbol, String permitted_scalar_filter(params, filter) - when Hash then + when Hash hash_filter(params, filter) end end @@ -549,7 +549,7 @@ module ActionController new_instance_with_inherited_permitted_status(@parameters.select(&block)) end - # Equivalent to Hash#keep_if, but returns nil if no changes were made. + # Equivalent to Hash#keep_if, but returns +nil+ if no changes were made. def select!(&block) @parameters.select!(&block) self @@ -807,11 +807,12 @@ module ActionController def permit_any_in_parameters(params) self.class.new.tap do |sanitized| params.each do |key, value| - if permitted_scalar?(value) + case value + when ->(v) { permitted_scalar?(v) } sanitized[key] = value - elsif value.is_a?(Array) + when Array sanitized[key] = permit_any_in_array(value) - elsif value.is_a?(Parameters) + when Parameters sanitized[key] = permit_any_in_parameters(value) else # Filter this one out. @@ -824,9 +825,10 @@ module ActionController def permit_any_in_array(array) [].tap do |sanitized| array.each do |element| - if permitted_scalar?(element) + case element + when ->(e) { permitted_scalar?(e) } sanitized << element - elsif element.is_a?(Parameters) + when Parameters sanitized << permit_any_in_parameters(element) else # Filter this one out. |