instance method deep_munge

Ruby on Rails 3.2.22.5

Since v3.0.20 Last seen in v4.2.9

Available in: v3.0.20 v3.1.12 v3.2.22.5 v4.0.13 v4.1.16 v4.2.9

Signature

deep_munge(hash)

Remove nils from the params hash

Parameters

hash req
Source
# File actionpack/lib/action_dispatch/http/request.rb, line 257
    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

Defined in actionpack/lib/action_dispatch/http/request.rb line 257 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionDispatch::Request

Type at least 2 characters to search.

↑↓ navigate · open · esc close