Home > OS >  How to write the cocoon delete link with an icon
How to write the cocoon delete link with an icon

Time:12-17

I'm using rails 5, gem 'cocoon' and 'twitter-bootstrap-rails' v.4.0.0. I want to exchange below "Delete" for link_to_remove_association with a bootstrap trash icon.

<%= link_to_remove_association "Delete", f, class: 'btn btn-danger' %>
<%= link_to_remove_association, f, do %>        
 <span  aria-hidden="true"></span>
<% end %>

I tried as above, but the syntac errors shows:

"syntax error, unexpected keyword_do_block ...nk_to_remove_association, f, do @output_buffer.safe_append='... ... ^~ syntax error, unexpected keyword_ensure, expecting end-of-input ensure ^~~~~~"

How should I write correctly?

CodePudding user response:

I could solve this problem:

<%= link_to_remove_association '<span  aria-hidden="true"></span>'.html_safe, f, class: 'btn btn-danger' %>
  • Related