From c8cc7c175b44c6fb1a172ddee6a763ead5335383 Mon Sep 17 00:00:00 2001 From: Anil Wadghule Date: Sun, 16 May 2010 00:42:02 +0530 Subject: [PATCH] Replace & to & in urls passed to page.redirect_to [#162 state:resolved] --- .../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 a798c3e..5a2a59a 100644 --- a/actionpack/lib/action_view/helpers/prototype_helper.rb +++ b/actionpack/lib/action_view/helpers/prototype_helper.rb @@ -436,7 +436,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('&', '&') : @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 0ff37f4..afb3138 100644 --- a/actionpack/test/template/prototype_helper_test.rb +++ b/actionpack/test/template/prototype_helper_test.rb @@ -193,6 +193,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.7.0.4