Last Updated on November 30, 2019 by Christopher G Mendla
link_to can be modified to show a button instead of a text link. The trick is to enclose the link/button text in a button tag and add .html_safe .
<%= link_to ““.html_safe, ‘http://blog.chrismendlatech.com’, target:’_blank’, class: ‘button’%>
<%= link_to "< button>My Blog< /button>".html_safe, 'http://blog.chrismendlatech.com', target:'_blank', class: 'button'%>
Since there is no user input here, html_safe should be safe to use. However, you need to decide for yourself on a case by case basis.