title: Escaping quotes from Rails Variables when using them for Javascript?
body: <p>I am having problems when trying to use a rails variable within javascript code.</p>
  
  <p>For example, I might define a link_to_remote, with parameter
  <code>:complete =&gt; "alert('my_var');"</code></p>
  
  <p>If <code>my_var = "I'm testing."</code>, then the javascript code will break due to the single quote closing the code prematurely. If I try using <code>escape_javascript(my_var)</code> so that the quote gets turned into <code>\'</code>, it doesn't seem to fix the problem.</p>
  
  <p>I've noticed that when you try <code>alert('I\'m testing');</code> there's a problem, but if you do <code>alert('I\\'m testing')</code>, it works. Since escape_javascript only turns <code>'</code> into <code>\'</code>, rather than <code>\\'</code>, does somebody have a suggestion for how to handle this?</p>
  
  <p>Thanks!
  Eric</p>