title: Rails escaping quotation mark in link_to_function partial
body: <p>I have a little piece of rails code which lets users enter a review.  If one already is written it displays the current review with a link to edit it.</p>
  
  <pre><code>      &lt;div id="text_area"&gt;
          &lt;% if @user_rating.review.blank? %&gt;
            &lt;%= render :partial =&gt; "reviews/text_area" %&gt;
          &lt;% else %&gt;
            &lt;%= simple_format @user_rating.review %&gt;
            &lt;%= link_to_function "Edit Review" do |page|
              page.replace_html :text_area, :partial =&gt; "reviews/text_area"
            end %&gt;
          &lt;% end %&gt;
        &lt;/div&gt;
  </code></pre>
  
  <p>This works correctly EXCEPT if the review contains a double quote character.  Here is the HTML output it generates after a user has already written a review (the else block from above).</p>
  
  <pre><code>      &lt;div id="text_area"&gt;
            &lt;p&gt;some text with "quotation marks"&lt;/p&gt;
            &lt;a href="#" onclick="try {
  Element.update(&amp;quot;text_area&amp;quot;, &amp;quot;&amp;lt;form action=\&amp;quot;/pages/iphone-reviews/reviews/new/write\&amp;quot; class=\&amp;quot;edit_rating\&amp;quot; id=\&amp;quot;edit_rating_16\&amp;quot; method=\&amp;quot;post\&amp;quot;&amp;gt;&amp;lt;div style=\&amp;quot;margin:0;padding:0\&amp;quot;&amp;gt;&amp;lt;input name=\&amp;quot;_method\&amp;quot; type=\&amp;quot;hidden\&amp;quot; value=\&amp;quot;put\&amp;quot; /&amp;gt;&amp;lt;input name=\&amp;quot;authenticity_token\&amp;quot; type=\&amp;quot;hidden\&amp;quot; value=\&amp;quot;fSZK30kpWEUtCxOvr4xDF1O+puDiPm87mhaxaLirIT8=\&amp;quot; /&amp;gt;&amp;lt;/div&amp;gt;\n        &amp;lt;textarea cols=\&amp;quot;40\&amp;quot; id=\&amp;quot;rating_review\&amp;quot; name=\&amp;quot;rating[review]\&amp;quot; rows=\&amp;quot;20\&amp;quot; style=\&amp;quot;width:100%;height:150px;\&amp;quot;&amp;gt;some text with &amp;quot;quotation marks&amp;quot;&amp;lt;/textarea&amp;gt;\n&amp;lt;/form&amp;gt;&amp;quot;);
  } catch (e) { alert('RJS error:\n\n' + e.toString()); alert('Element.update(\&amp;quot;text_area\&amp;quot;, \&amp;quot;&amp;lt;form action=\\\&amp;quot;/pages/iphone-reviews/reviews/new/write\\\&amp;quot; class=\\\&amp;quot;edit_rating\\\&amp;quot; id=\\\&amp;quot;edit_rating_16\\\&amp;quot; method=\\\&amp;quot;post\\\&amp;quot;&amp;gt;&amp;lt;div style=\\\&amp;quot;margin:0;padding:0\\\&amp;quot;&amp;gt;&amp;lt;input name=\\\&amp;quot;_method\\\&amp;quot; type=\\\&amp;quot;hidden\\\&amp;quot; value=\\\&amp;quot;put\\\&amp;quot; /&amp;gt;&amp;lt;input name=\\\&amp;quot;authenticity_token\\\&amp;quot; type=\\\&amp;quot;hidden\\\&amp;quot; value=\\\&amp;quot;fSZK30kpWEUtCxOvr4xDF1O+puDiPm87mhaxaLirIT8=\\\&amp;quot; /&amp;gt;&amp;lt;/div&amp;gt;\\n        &amp;lt;textarea cols=\\\&amp;quot;40\\\&amp;quot; id=\\\&amp;quot;rating_review\\\&amp;quot; name=\\\&amp;quot;rating[review]\\\&amp;quot; rows=\\\&amp;quot;20\\\&amp;quot; style=\\\&amp;quot;width:100%;height:150px;\\\&amp;quot;&amp;gt;some text with &amp;quot;quotation marks&amp;quot;&amp;lt;/textarea&amp;gt;\\n&amp;lt;/form&amp;gt;\&amp;quot;);'); throw e }; return false;"&gt;Edit Review&lt;/a&gt;
  
        &lt;/div&gt;
  </code></pre>
  
  <p>This example breaks because the text of the review contains a double quote.  It works with single quotes and any other text I can think of.  I think rails is not escaping the double quote correctly in the javascript.</p>
  
  <p>The error which comes up in Firebug is this:</p>
  
  <blockquote>
    <p>missing ) after argument list
    [Break on this error] \" id=\"rating_review\" name=\"rating[re...n:right;\">\n 
  </blockquote>
  
  <p>I'm at a loss on how to fix this one.  Thanks!</p>