Assuming your like
action is in your ProductsController
, and you have set @products
equal to the products you want for your index page, and you're using erb, put something like this in your view:
<% @products.each do |product| %>
<%= link_to "Like", product_link_path(id: product.id) %>
<% end %>
Even if you have it set up differently, it can't be too far off from this.