instance method
deep_munge
Ruby on Rails 2.3.18
Since v2.3.18 Last seen in v2.3.18Signature
deep_munge(hash)
Remove nils from the params hash
Parameters
-
hashreq
Source
# File actionpack/lib/action_controller/request.rb, line 497
def deep_munge(hash)
keys = hash.keys.find_all { |k| hash[k] == [nil] }
keys.each { |k| hash[k] = nil }
hash.each_value do |v|
case v
when Array
v.grep(Hash) { |x| deep_munge(x) }
v.compact!
when Hash
deep_munge(v)
end
end
hash
end
Defined in actionpack/lib/action_controller/request.rb line 497
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionController::Request