I totally recommend marflar to answer above.
However, I would add one comment, which is that if you use html elements in the link_to block, this can apply the default rails link style, which may be undesirable.
One option is to use the button_to link, but do not forget that the default method for this is POST, so specify the parameters as GET:
button_to(user_listing_url(listing.user, listing), method: :get) do %> <div></div> <% end %>
source share