9

I have this code to generate a "unfollow" button via the 'link_to' function:

<%= link_to "Non seguire più", user_user_relationship_path(id:@relationship.id), remote: true, id: "follow_#{@user.id}", class:"btn btn-small btn-danger", method: :delete %>

I would like to know ho to use the "do..end" syntax with all those arguments.. Thanks!

Ciampo
  • 133
  • 1
  • 7
  • What are you trying to accomplish? Why would you want to stick a block in there? – varatis Aug 29 '12 at 22:09
  • i would like to add an icon, as illustrated in bootstrap [documentation](http://twitter.github.com/bootstrap/base-css.html#icons) – Ciampo Aug 30 '12 at 13:49

1 Answers1

20

You just skip the first parameter, can wrap the rest in parens, and then add the do/end.

<%= link_to(user_user_relationship_path(id:@relationship.id), remote: true, id: "follow_#{@user.id}", class:"btn btn-small btn-danger", method: :delete) do %>
  <!-- your button html here -->
<% end %>
deefour
  • 34,974
  • 7
  • 97
  • 90