4

我的原始代码是

<%= button_to 'Destroy', girl, confirm: 'Are you sure?', :disable_with => 'deleting...', method: :delete, :class => 'btn-mini btn-danger btn'  %>

我想在“Destroy”一词前添加一个图标。

图标标签是这个

<i class="icon-pencil icon-white"></i>

我怎样才能做到这一点??

4

1 回答 1

9

尝试使用块

<%= link_to girl, confirm: 'Are you sure?', disable_with: 'deleting...', method: :delete, class: 'btn-mini btn-danger btn' do %>
  <i class="icon-pencil icon-white"></i> Destroy
<% end %>

http://apidock.com/rails/v3.2.1/ActionView/Helpers/UrlHelper/button_to

http://apidock.com/rails/v3.2.1/ActionView/Helpers/UrlHelper/link_to

于 2012-07-13T05:19:04.437 回答