在rails 3中使用button_to"delete"的bootstrap图标

mis*_*dik 2 css ruby ruby-on-rails ruby-on-rails-3 twitter-bootstrap

我有这个编辑按钮:

<%= link_to edit_income_path(trans), class: "btn btn-default" do %>
<i class="glyphicon glyphicon-pencil"></i>
<% end %>
Run Code Online (Sandbox Code Playgroud)

我想要一个删除按钮看起来与此图标相同:glyphicon glyphicon-trash,但我找不到合适的语法使其工作和看起来一样.我的删除按钮现在:

<%= button_to "delete", trans, :method=> :delete, :remote=> true %>
Run Code Online (Sandbox Code Playgroud)

这就是它的样子

Jus*_*tin 6

这是你想要的??

<%= button_to trans, method: :delete, remote: true, class: "btn btn-default" do %>
  <span class="glyphicon glyphicon-trash"></span>
<% end %>
Run Code Online (Sandbox Code Playgroud)