What I want to implement this time is an implementation that gives a link to a button like the image below with the link_to method.
By clicking this'List'button, you can move to the link of the given product posting page.
There are two ways to implement this feature. I don't know why link_to is better ...
・ Description in a href element
ruby:xxx.html.erb
<a href="path">
Description of listing images and text
</a>
・ Description with link_to
ruby:xxx.html.erb
<%= link_to("URL") do %>
Write the HTML code here
<% end %>
The code written in this implementation is pasted as a reference example.
ruby:xxx.html.erb
<div class='purchase-btn'>
<span class='purchase-btn-text'>Sell</span>
<%= link_to ("/products/new") do %>
<%= image_tag 'camera.png' , size: '185x50' ,class: "purchase-btn-icon" %>
<% end %>
</div>
Recommended Posts