diff options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/url_rewriter.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/url_rewriter_test.rb | 9 |
3 files changed, 12 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index e0ccd0b753..fbf0f9811a 100644 --- a/actionpack/CHANGELOG +++ b/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] diff --git a/actionpack/lib/action_controller/url_rewriter.rb b/actionpack/lib/action_controller/url_rewriter.rb index 0a5aab14d1..71f87ad373 100644 --- a/actionpack/lib/action_controller/url_rewriter.rb +++ b/actionpack/lib/action_controller/url_rewriter.rb @@ -96,7 +96,7 @@ module ActionController 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} diff --git a/actionpack/test/controller/url_rewriter_test.rb b/actionpack/test/controller/url_rewriter_test.rb index 882add496f..d3bee976a2 100644 --- a/actionpack/test/controller/url_rewriter_test.rb +++ b/actionpack/test/controller/url_rewriter_test.rb @@ -17,6 +17,15 @@ class UrlRewriterTests < Test::Unit::TestCase 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) |