Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #4394 (closed defect: untested)

Opened 2 years ago

Last modified 1 year ago

[PATCH] Allow the query string parameters separator to be changed

Reported by: m@absolight.fr Assigned to: David
Priority: normal Milestone:
Component: ActionPack Version:
Severity: normal Keywords:
Cc:

Description

There are two separators commonly accepted, and they are & and ;, while & is mostly used, I do rather use ; so, here's the patch to allow it to be changed.

Index: actionpack/lib/action_controller/url_rewriter.rb
===================================================================
--- actionpack/lib/action_controller/url_rewriter.rb    (révision 4021)
+++ actionpack/lib/action_controller/url_rewriter.rb    (copie de travail)
@@ -3,6 +3,7 @@

   class UrlRewriter #:nodoc:
     RESERVED_OPTIONS = [:anchor, :params, :only_path, :host, :protocol, :trailing_slash, :skip_relative_url_root]
+    PARAMETER_SEPARATOR = "&"
     def initialize(request, parameters)
       @request, @parameters = request, parameters
     end
@@ -67,7 +68,7 @@
           value.each { |val| elements << "#{key}=#{Routing.extract_parameter_value(val)}" }
         end

-        query_string << ("?" + elements.join("&")) unless elements.empty?
+        query_string << ("?" + elements.join(PARAMETER_SEPARATOR)) unless elements.empty?
         query_string
       end
   end

Change History

01/14/07 21:01:24 changed by dcmanges

  • status changed from new to closed.
  • resolution set to untested.

Other code in Rails assumes the ampersand is used, such as CGIMethods.parse_query_parameters