aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http
diff options
context:
space:
mode:
authorGenadi Samokovarov <gsamokovarov@gmail.com>2013-05-30 21:26:37 +0300
committerGenadi Samokovarov <gsamokovarov@gmail.com>2013-05-30 21:26:37 +0300
commit5438f6866efa679331e5c998ecbc5948e80cd503 (patch)
treebd1b32d2845b39877d512cb0e38c8a3bc45cf250 /actionpack/lib/action_dispatch/http
parentc2f3efffd905f8f21eb5ea88687b738fe8a119a2 (diff)
downloadrails-5438f6866efa679331e5c998ecbc5948e80cd503.tar.gz
rails-5438f6866efa679331e5c998ecbc5948e80cd503.tar.bz2
rails-5438f6866efa679331e5c998ecbc5948e80cd503.zip
Extract ActionDispatch::Request#deep_munge
ActionDispatch::Request#deep_munge was introduced as a private method, but was turned into a public one for the use of ActionDispatch::ParamsParser. I have extracted it into ActionDispatch::Request::Utils, so it does not get mixed up with the Request public methods.
Diffstat (limited to 'actionpack/lib/action_dispatch/http')
-rw-r--r--actionpack/lib/action_dispatch/http/request.rb19
1 files changed, 2 insertions, 17 deletions
diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb
index ebd87c40b5..4ca1d35489 100644
--- a/actionpack/lib/action_dispatch/http/request.rb
+++ b/actionpack/lib/action_dispatch/http/request.rb
@@ -22,6 +22,7 @@ module ActionDispatch
include ActionDispatch::Http::URL
autoload :Session, 'action_dispatch/request/session'
+ autoload :Utils, 'action_dispatch/request/utils'
LOCALHOST = Regexp.union [/^127\.0\.0\.\d{1,3}$/, /^::1$/, /^0:0:0:0:0:0:0:1(%.*)?$/]
@@ -299,26 +300,10 @@ module ActionDispatch
LOCALHOST =~ remote_addr && LOCALHOST =~ remote_ip
end
- # 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
-
protected
def parse_query(qs)
- deep_munge(super)
+ Utils.deep_munge(super)
end
private