Custom link_to in Rails
You now that is possible pass a block to a link_to method? :)
Sometimes we need custom html markup inside our links, and here's the easiest way to it with rails routes:
<%= link_to destroy_user_session_path, class: "logout-link" do %>
logout <i class="icon-off"></i>
<% end %>
Written by Bruno
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#