title: Rails 3.2 using content_tag to generate a 'Delete' button with twitter-bootstrap icons
body: <p>I'm trying to replicate the Delete button icon in this example using the Rails 3 content_tag method, within a nested form and using jQuery unobtrusively (or at least I hope to be).</p>
  <p><a href="http://www.w3resource.com/twitter-bootstrap/example-icon-buttons.html#" rel="noreferrer">Twitter-Bootstrap Delete Button icon (example)</a></p>
  <p>The html produced in when inspecting with Firebug is below.</p>
  <pre><code>&lt;a class=&quot;btn btn-danger&quot; href=&quot;#&quot;&gt;
    &lt;i class=&quot;icon-trash icon-white&quot;&gt;&lt;/i&gt;
    Delete
  &lt;/a&gt;
  </code></pre>
  <p>I'm using the following to generate the button with an icon but cannot add the &quot;Delete Ingredients&quot; to it, nor do I get the &quot;#&quot; for the href.</p>
  <p>Here is my code from within the ingredients partial:</p>
  <pre><code>&lt;%= link_to content_tag(:a, content_tag(:i, '', class: &quot;icon-trash icon-white&quot;), class: &quot;btn btn-danger remove_fields&quot;) %&gt;
  </code></pre>
  <p>This generates:</p>
  <pre><code>&lt;a class=&quot;btn btn-danger remove_fields&quot;&gt;
    &lt;i class=icon-trash icon-white&quot;&gt;&lt;/i&gt;
  &lt;/a&gt;
  </code></pre>
  <p>This was based on information from
  <a href="http://apidock.com/rails/ActionView/Helpers/TagHelper/content_tag" rel="noreferrer">Api dock - content_tag</a></p>
  <p>which had the following code example:</p>
  <pre><code>content_tag(:div, content_tag(:p, &quot;Hello world!&quot;), :class =&gt; &quot;strong&quot;)
  # =&gt; &lt;div class=&quot;strong&quot;&gt;&lt;p&gt;Hello world!&lt;/p&gt;&lt;/div&gt;
  </code></pre>
  <h3>Can someone kindly point me in the right direction? Why am I missing details I mentioned above?</h3>
  <p>N.B. I can get this to work with a link_to block but wanted to know if this can be done in one line without the do..end and more importantly in a content_for method.</p>
  <pre><code>&lt;%= link_to('#', class: &quot;btn btn-danger remove_fields&quot;) do %&gt;
    &lt;i class: &quot;icon-trash icon-white&quot;&gt;&lt;/i&gt;
    Delete
  &lt;% end %&gt;
  </code></pre>