class ActionController::Parameters

def permit_any_in_array(array)

def permit_any_in_array(array)
  [].tap do |sanitized|
    array.each do |element|
      case element
      when ->(e) { permitted_scalar?(e) }
        sanitized << element
      when Array
        sanitized << permit_any_in_array(element)
      when Parameters
        sanitized << permit_any_in_parameters(element)
      else
        # Filter this one out.
      end
    end
  end
end