From a2c4c250d0dc0e25a5c3557c2de48b5b3ced843e Mon Sep 17 00:00:00 2001 From: Mike Breen Date: Thu, 26 Mar 2009 09:44:06 -0400 Subject: [PATCH] remove amp; in urls passed to page.redirect_to --- .../lib/action_view/helpers/prototype_helper.rb | 2 +- actionpack/test/template/prototype_helper_test.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb index 91ef72e..9b0d84b 100644 --- a/actionpack/lib/action_view/helpers/prototype_helper.rb +++ b/actionpack/lib/action_view/helpers/prototype_helper.rb @@ -860,7 +860,7 @@ module ActionView # # Generates: window.location.href = "/account/signup"; # page.redirect_to(:controller => 'account', :action => 'signup') def redirect_to(location) - url = location.is_a?(String) ? location : @context.url_for(location) + url = location.is_a?(String) ? location.gsub('amp;', '') : @context.url_for(location) record "window.location.href = #{url.inspect}" end diff --git a/actionpack/test/template/prototype_helper_test.rb b/actionpack/test/template/prototype_helper_test.rb index d6b86a3..32d7ae3 100644 --- a/actionpack/test/template/prototype_helper_test.rb +++ b/actionpack/test/template/prototype_helper_test.rb @@ -361,6 +361,8 @@ class JavaScriptGeneratorTest < PrototypeHelperBaseTest @generator.redirect_to(:action => 'welcome') assert_equal 'window.location.href = "http://www.example.com/welcome?a=b&c=d";', @generator.redirect_to("http://www.example.com/welcome?a=b&c=d") + assert_equal 'window.location.href = "http://www.example.com/welcome?a=b&c=d";', + @generator.redirect_to("http://www.example.com/welcome?a=b&c=d") end def test_reload -- 1.6.1.3