aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb25
1 files changed, 1 insertions, 24 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index 201cf462e4..a8073c2105 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -435,7 +435,7 @@ module ActionDispatch
end
end
- uri << "?#{build_nested_query(params)}" if uri && params.any?
+ uri << "?#{params.to_query}" if uri && params.any?
path = uri
if path && method == :generate_extras
@@ -504,29 +504,6 @@ module ActionDispatch
def extract_request_environment(request)
{ :method => request.method }
end
-
- private
- def build_nested_query(value, prefix = nil)
- case value
- when Array
- value.map { |v|
- build_nested_query(v, "#{prefix}[]")
- }.join("&")
- when Hash
- value.map { |k, v|
- build_nested_query(v, prefix ? "#{prefix}[#{k}]" : k)
- }.join("&")
- when String
- raise ArgumentError, "value must be a Hash" if prefix.nil?
- "#{prefix}=#{Rack::Utils.escape(value)}"
- else
- if value.respond_to?(:to_param)
- build_nested_query(value.to_param.to_s, prefix)
- else
- Rack::Utils.escape(prefix)
- end
- end
- end
end
end
end