Interpolation with single quotes
<p>I have this Javascript code inside an .erb file in Ruby on Rails:</p>

<pre><code>&lt;script type="text/javascript"&gt;

...

function show_all_categories_terms_contents() {
  $('#categories_terms_root2').show();
  $('#categories_terms_root3').show();

...

&lt;/script&gt;
</code></pre>

<p>I need to perform a loop to create as many <code>#categories_terms_root</code> as I need, instead of adding a new line for each one.</p>

<p>I tried various things, but none worked for me:</p>

<pre><code>function show_all_categories_terms_contents() {
  for(int i=2; i&lt;=6; i++)
    $(String.concat("#categories_terms_root", i)).show();

}
</code></pre>
