Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix doubly appearing parameters due to string and symbol mixups. Closes

#2551.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6053 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 35ec1c928f100f5b75bd2e6af63d26b10ba2282c 1 parent c7f50e9
@seckar seckar authored
View
2  actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fix doubly appearing parameters due to string and symbol mixups. Closes #2551. [aeden]
+
* Fix overly greedy rescues when loading helpers. Fixes #6268. [Nicholas Seckar]
* Fixed NumberHelper#number_with_delimiter to use "." always for splitting the original number, not the delimiter parameter #7389 [ceefour]
View
2  actionpack/lib/action_controller/url_rewriter.rb
@@ -96,7 +96,7 @@ def rewrite_path(options)
options.update(options[:params].symbolize_keys) if options[:params]
if (overwrite = options.delete(:overwrite_params))
options.update(@parameters.symbolize_keys)
- options.update(overwrite)
+ options.update(overwrite.symbolize_keys)
end
RESERVED_OPTIONS.each {|k| options.delete k}
View
9 actionpack/test/controller/url_rewriter_test.rb
@@ -17,6 +17,15 @@ def test_overwrite_params
assert_match %r(/hi/hi/2$), u
end
+ def test_overwrite_removes_original
+ @params[:controller] = 'search'
+ @params[:action] = 'list'
+ @params[:list_page] = 1
+
+ assert_equal '/search/list?list_page=2', @rewriter.rewrite(:only_path => true, :overwrite_params => {"list_page" => 2})
+ u = @rewriter.rewrite(:only_path => false, :overwrite_params => {:list_page => 2})
+ assert_equal 'http://test.host/search/list?list_page=2', u
+ end
private
def split_query_string(str)
Please sign in to comment.
Something went wrong with that request. Please try again.