This isn't super sexy, but it works!!
<%= form_tag({controller:'videos', action:'rate', id: video.hashed_id, yesno:'no', format: 'json'}, {remote:true} ) do %>
<%= button_tag '', :class=>"rate-btn yes-btn btn btn-default btn-lg glyphicon glyphicon-thumbs-down" %>
<% end %>
Basically (as mentioned in the comments above), the issue is that the syntax used by glyphicon can't be used on self-closing elements like <input />
so you need a button. Unfortunately Rails's button_to
also generates an <input />
(inside of a form). You could write the form by hand with a but you'll run into problems with Rails's built-in forgery prevention system (you need an authenticity token). So instead, I combine the form_tag
and the button_tag
with corresponding classes and we're good to go.