Skip to content

Commit 1ff2d8b

Browse files
authored
Merge pull request #1904 from codidact/0valt/1902/query_url
query_url helper should correctly rebuild merged query
2 parents 8cb8355 + a54954a commit 1ff2d8b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

app/helpers/application_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def check_your_privilege(privilege)
4848
end
4949

5050
##
51-
# Utility to add additional query parameters to a URI.
51+
# Adds additional query parameters to a URI.
5252
# @param base_url [String, nil] A base URI to which to add parameters. If none is specified then the request URI for
5353
# the current page will be used.
5454
# @param params [Hash{#to_s => #to_s}] A hash of query parameters to add to the URI.
@@ -65,7 +65,7 @@ def query_url(base_url = nil, **params)
6565
end
6666

6767
query = query.merge(params.to_h { |k, v| [k.to_s, v.to_s] })
68-
uri.query = query.map { |k, v| "#{k}=#{v}" }.join('&')
68+
uri.query = Rack::Utils.build_nested_query(query)
6969
uri.to_s
7070
end
7171

0 commit comments

Comments
 (0)