<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,7 @@
 *SVN*
 
+* Fix double url escaping of remote_function. Add :escape =&gt; false option to ActionView's url_for. [Nicholas Seckar]
+
 * Add :script option to in_place_editor to support evalScripts (closes #4194) [codyfauser@gmail.com]
 
 * Fix mixed case enumerable methods in the JavaScript Collection Proxy (closes #4314) [codyfauser@gmail.com]</diff>
      <filename>actionpack/CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -301,7 +301,9 @@ module ActionView
           &quot;new Ajax.Request(&quot; :
           &quot;new Ajax.Updater(#{update}, &quot;
 
-        function &lt;&lt; &quot;'#{url_for(options[:url])}'&quot;
+        url_options = options[:url]
+        url_options = url_options.merge(:escape =&gt; false) if url_options.is_a? Hash
+        function &lt;&lt; &quot;'#{url_for(url_options)}'&quot;
         function &lt;&lt; &quot;, #{javascript_options})&quot;
 
         function = &quot;#{options[:before]}; #{function}&quot; if options[:before]</diff>
      <filename>actionpack/lib/action_view/helpers/prototype_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -13,9 +13,19 @@ module ActionView
       # as url_for. For a list, see the documentation for ActionController::Base#url_for.
       # Note that it'll set :only_path =&gt; true so you'll get /controller/action instead of the 
       # http://example.com/controller/action part (makes it harder to parse httpd log files)
+      # 
+      # When called from a view, url_for returns an HTML escaped url. If you need an unescaped
+      # url, pass :escape =&gt; false to url_for.
+      # 
       def url_for(options = {}, *parameters_for_method_reference)
-        options = { :only_path =&gt; true }.update(options.symbolize_keys) if options.kind_of? Hash
-        html_escape(@controller.send(:url_for, options, *parameters_for_method_reference))
+        if options.kind_of? Hash
+          options = { :only_path =&gt; true }.update(options.symbolize_keys)
+          escape = options.key?(:escape) ? options.delete(:escape) : true
+        else
+          escape = true
+        end
+        url = @controller.send(:url_for, options, *parameters_for_method_reference)
+        escape ? html_escape(url) : url
       end
 
       # Creates a link tag of the given +name+ using an URL created by the set of +options+. See the valid options in</diff>
      <filename>actionpack/lib/action_view/helpers/url_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -16,6 +16,8 @@ module BaseTest
       def url_for(options, *parameters_for_method_reference)
         url =  &quot;http://www.example.com/&quot;
         url &lt;&lt; options[:action].to_s if options and options[:action]
+        url &lt;&lt; &quot;?a=#{options[:a]}&quot; if options &amp;&amp; options[:a]
+        url &lt;&lt; &quot;&amp;b=#{options[:b]}&quot; if options &amp;&amp; options[:a] &amp;&amp; options[:b]
         url
       end
     end.new
@@ -40,6 +42,8 @@ class PrototypeHelperTest &lt; Test::Unit::TestCase
       link_to_remote(&quot;Remote outpost&quot;, :success =&gt; &quot;alert(request.reponseText)&quot;, :url =&gt; { :action =&gt; &quot;whatnot&quot;  })
     assert_dom_equal %(&lt;a href=\&quot;#\&quot; onclick=\&quot;new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, onFailure:function(request){alert(request.reponseText)}}); return false;\&quot;&gt;Remote outpost&lt;/a&gt;),
       link_to_remote(&quot;Remote outpost&quot;, :failure =&gt; &quot;alert(request.reponseText)&quot;, :url =&gt; { :action =&gt; &quot;whatnot&quot;  })
+    assert_dom_equal %(&lt;a href=\&quot;#\&quot; onclick=\&quot;new Ajax.Request('http://www.example.com/whatnot?a=10&amp;amp;b=20', {asynchronous:true, evalScripts:true, onFailure:function(request){alert(request.reponseText)}}); return false;\&quot;&gt;Remote outpost&lt;/a&gt;),
+      link_to_remote(&quot;Remote outpost&quot;, :failure =&gt; &quot;alert(request.reponseText)&quot;, :url =&gt; { :action =&gt; &quot;whatnot&quot;, :a =&gt; '10', :b =&gt; '20' })
   end
   
   def test_periodically_call_remote</diff>
      <filename>actionpack/test/template/prototype_helper_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -25,6 +25,8 @@ class UrlHelperTest &lt; Test::Unit::TestCase
   def test_url_for_escapes_urls
     @controller.url = &quot;http://www.example.com?a=b&amp;c=d&quot;
     assert_equal &quot;http://www.example.com?a=b&amp;amp;c=d&quot;, url_for(:a =&gt; 'b', :c =&gt; 'd')
+    assert_equal &quot;http://www.example.com?a=b&amp;amp;c=d&quot;, url_for(:a =&gt; 'b', :c =&gt; 'd', :escape =&gt; true)
+    assert_equal &quot;http://www.example.com?a=b&amp;c=d&quot;, url_for(:a =&gt; 'b', :c =&gt; 'd', :escape =&gt; false)
   end
   
   # todo: missing test cases</diff>
      <filename>actionpack/test/template/url_helper_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>2d24bed3a072aac1a0087ec4c4681889e49ea6a4</id>
    </parent>
  </parents>
  <author>
    <name>Nicholas Seckar</name>
    <email>nseckar@gmail.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/c05c22a45f9332f50eb6efae5a393268f6b6609d</url>
  <id>c05c22a45f9332f50eb6efae5a393268f6b6609d</id>
  <committed-date>2006-03-22T11:41:39-08:00</committed-date>
  <authored-date>2006-03-22T11:41:39-08:00</authored-date>
  <message>Fix double url escaping of remote_function. Add :escape =&gt; false option to ActionView's url_for.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4014 5ecf4fe2-1ee6-0310-87b1-e25e094e27de</message>
  <tree>aded989d9cb75e5a8a5bec5bc4763e860de7240c</tree>
  <committer>
    <name>Nicholas Seckar</name>
    <email>nseckar@gmail.com</email>
  </committer>
</commit>
