I am using the inline_svg gem to render SVGs for my icons. My view code looks like this:
<div class="icon">
  <%= link_to inline_svg(listing.favorite_icon, class: "svg"), favorite_listing_path(id: listing.id), method: :post  %>
</div>
I have a heart icon that, when the user clicks it, a POST should be made to the Rails favorite route.  I tested this in Postman and it does correctly work outside of my view.  But, inside of my view, clicking favorite generates a GET.
I know I can use button_to instead of link_to and the POST will then happen..BUT...button_to doesn't render my SVG properly (see attached pics).
So I can go one of two ways...can someone help me get my link_to to POST? Or can someone give me a clue as to why my SVG doesn't render correctly with button_to?
With link_to:
With button_to:
UPDATE:  Here are some things I have tried...clicking still results in a GET.  Also, I'm on Rails 4.2 if that makes a difference at all.
<%= link_to "hi", controller: "listings", action: "favorite", id: listing.id, method: :post  %>
<%= link_to(inline_svg(listing.favorite_icon, class: "svg"), controller: "listings", action: "favorite", id: listing.id, method: :post)  %>
<%= link_to(favorite_listing_path(id: listing.id), method: :post)  do %>
  <div class="icon">
    <%= inline_svg(listing.favorite_icon, class: "svg") %>
  </div>
<% end %>


 
     
    