diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-12-02 15:23:26 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-12-02 15:23:26 -0600 |
commit | 399909b11c094ab32542d300c72940b1b263b8e6 (patch) | |
tree | e316b8ca72f2bef50668c222400a159b36fbc090 /actionpack/lib | |
parent | 856d2fd874d72dd9f83204affff4edfef3308361 (diff) | |
download | rails-399909b11c094ab32542d300c72940b1b263b8e6.tar.gz rails-399909b11c094ab32542d300c72940b1b263b8e6.tar.bz2 rails-399909b11c094ab32542d300c72940b1b263b8e6.zip |
Use to_query in route query string generation
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 25 |
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 |