Sha256: abd16fb161b137b65df30c98cb3f9c857eead56526499b22a443f23703dec9bb

Contents?: true

Size: 495 Bytes

Versions: 2

Compression:

Stored size: 495 Bytes

Contents

module ActionDispatch
  class Request < Rack::Request
    class Utils # :nodoc:
      class << self
        # Remove nils from the params hash
        def deep_munge(hash)
          hash.each do |k, v|
            case v
            when Array
              v.grep(Hash) { |x| deep_munge(x) }
              v.compact!
              hash[k] = nil if v.empty?
            when Hash
              deep_munge(v)
            end
          end

          hash
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
actionpack-4.1.0.beta2 lib/action_dispatch/request/utils.rb
actionpack-4.1.0.beta1 lib/action_dispatch/request/utils.rb