title: How can I escape single quotation marks using ruby on rails?
body: <p>I have a code as below,</p>
  <pre><code>&lt;% content_for(:tag_params) { &quot;[#{@tag.site.name.to_s.html_safe}.#{@tag.name.to_s.html_safe}]&quot; } %&gt;
  </code></pre>
  <p>which comes out as below;</p>
  <pre><code>[sitename.tagname]
  </code></pre>
  <p>I want to surround it with single quotation marks / double quotation marks as below;</p>
  <pre><code>['sitename.tagname']
  [&quot;sitename.tagname&quot;]
  </code></pre>
  <p>and I've tried the following codes, but none of them worked.</p>
  <pre><code># 1. Tried to escape the single quote using backslash.
  &lt;% content_for(:tag_params) { &quot;[\'#{@tag.site.name.to_s.html_safe}.#{@tag.name.to_s.html_safe}\']&quot; } %&gt;
  # outcome -&gt; [&amp;#39;sitename.tagname&amp;#39;]
  
  # 2. If I don't escape the single quote, I got the same outcome as above.
  &lt;% content_for(:tag_params) { &quot;['#{@tag.site.name.to_s.html_safe}.#{@tag.name.to_s.html_safe}']&quot; } %&gt;
  # outcome -&gt; [&amp;#39;sitename.tagname&amp;#39;]
  
  # 3. I tried using %Q[] and %(), which also gave me the same result.
  &lt;% content_for(:tag_params) { %('#{@tag.site.name.to_s.html_safe}.#{@tag.name.to_s.html_safe}') } %&gt;
  &lt;% content_for(:tag_params) { %Q['#{@tag.site.name.to_s.html_safe}.#{@tag.name.to_s.html_safe}'] } %&gt;
  # outcome -&gt; [&amp;#39;sitename.tagname&amp;#39;]
  </code></pre>
  <p>What can I do to surround the values successfully with a single/double quotation marks?</p>