Search code examples
ruby-on-rails-3html-sanitizingfont-awesomehtml-safe

Rails 3 Submit Tag + html_safe


What's wrong with this line of code?

<%= submit_tag "Delete <i class='icon-check'></i>".html_safe, :disable_with => "Deleting", :class => "btn btn-danger"%>

This literally produces:

enter image description here

Evidently my html_safe call isn't doing anything.

Background:

I'm using Twitter Bootstrap as well as Font Awesome and I'm essentially trying to achieve a submit button with an icon inside of it.


Solution

  • To extend on Lukas' answer I needed a button tag rather than an input. This code produced the effect I was looking for:

    <button type="submit" class="btn btn-danger">
        Delete <i class="icon-check"></i> 
    </button>
    

    Which resulted in:

    result

    I found the answer I was looking for here.