mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
do not override special param in url_for options
This commit is contained in:
parent
a049217643
commit
b973e007be
2 changed files with 9 additions and 0 deletions
|
@ -824,6 +824,8 @@ module ActionDispatch
|
|||
|
||||
if options[:params].is_a?(Hash)
|
||||
params.merge! options[:params]
|
||||
elsif options.key? :params
|
||||
params[:params] = options[:params]
|
||||
end
|
||||
|
||||
options[:path] = path
|
||||
|
|
|
@ -362,6 +362,13 @@ module AbstractController
|
|||
assert_equal({ id: "1" }.to_query, params[1])
|
||||
end
|
||||
|
||||
def test_non_hash_params_option
|
||||
url = W.new.url_for(only_path: true, controller: "c", action: "a", params: "p")
|
||||
params = extract_params(url)
|
||||
assert_equal("/c/a?params=p", url)
|
||||
assert_equal({ params: "p" }.to_query, params[0])
|
||||
end
|
||||
|
||||
def test_hash_parameter
|
||||
url = W.new.url_for(only_path: true, controller: "c", action: "a", query: { name: "Bob", category: "prof" })
|
||||
params = extract_params(url)
|
||||
|
|
Loading…
Reference in a new issue