Sha256: 9803e8391f0f36b664c00404b0becb699eeee190f64e3fa0611deb498a02fc35

Contents?: true

Size: 824 Bytes

Versions: 94

Compression:

Stored size: 824 Bytes

Contents

module ActionDispatch
  class Request < Rack::Request
    class Utils # :nodoc:

      mattr_accessor :perform_deep_munge
      self.perform_deep_munge = true

      class << self
        # Remove nils from the params hash
        def deep_munge(hash, keys = [])
          return hash unless perform_deep_munge

          hash.each do |k, v|
            keys << k
            case v
            when Array
              v.grep(Hash) { |x| deep_munge(x, keys) }
              v.compact!
              if v.empty?
                hash[k] = nil
                ActiveSupport::Notifications.instrument("deep_munge.action_controller", keys: keys)
              end
            when Hash
              deep_munge(v, keys)
            end
            keys.pop
          end

          hash
        end
      end
    end
  end
end

Version data entries

94 entries across 90 versions & 9 rubygems

Version Path
actionpack-4.2.11.3 lib/action_dispatch/request/utils.rb
actionpack-4.2.11.2 lib/action_dispatch/request/utils.rb
actionpack-4.2.11.1 lib/action_dispatch/request/utils.rb
actionpack-4.2.11 lib/action_dispatch/request/utils.rb
actionpack-4.2.10 lib/action_dispatch/request/utils.rb
actionpack-4.2.10.rc1 lib/action_dispatch/request/utils.rb
actionpack-4.2.9 lib/action_dispatch/request/utils.rb
actionpack-4.2.9.rc2 lib/action_dispatch/request/utils.rb
actionpack-4.2.9.rc1 lib/action_dispatch/request/utils.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/actionpack-4.2.8/lib/action_dispatch/request/utils.rb
actionpack-4.2.8 lib/action_dispatch/request/utils.rb
actionpack-4.2.8.rc1 lib/action_dispatch/request/utils.rb
actionpack-4.2.7.1 lib/action_dispatch/request/utils.rb
actionpack-4.2.7 lib/action_dispatch/request/utils.rb
actionpack-4.1.16 lib/action_dispatch/request/utils.rb
actionpack-4.1.16.rc1 lib/action_dispatch/request/utils.rb
actionpack-4.2.7.rc1 lib/action_dispatch/request/utils.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/request/utils.rb
actionpack-4.1.15 lib/action_dispatch/request/utils.rb
actionpack-4.2.6 lib/action_dispatch/request/utils.rb