I have the following code:
<a <%= link_to "Basket", product_items_path(product_id: product), :method => :post %><%= image_tag"/assets/addToBasket.png" %></a>
This displays the link that will add the item to the basket, along with the image below. How would I turn the image into a clickable link that will use a link and the post method?
link_to
can take a block like this.
<%= link_to product_items_path(product_id: product), method: :post do %>
<%= image_tag "addToBasket.png" %>
<% end %>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.