link_to with image_tag in Rails

This is very basic form tag in rails. but some time you get confused about using this tag.

How to displays a image inside link_to instead of text?

Here is answer:
<%= link_to image_tag(“/images/submit.jpg”, :border=>0), :action => ‘create’ %>

Section Option:

<%= link_to image_tag(“/images/submit.jpg”, :border=>0,:class=>’sub20′), :url =>{:controller=> ‘user’,:action=>’create’}  %>

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

2 thoughts on “link_to with image_tag in Rails”

  1. Amazing site, where did you come up with the information in this piece of content? I’m happy I found it though, ill be checking back soon to see what other articles you have.

  2. This is a really good write-up, I discovered your website researching google for a similar topic and arrived to this. I couldnt discover to much alternative information on this posting, so it was pleasant to discover this one. I likely will end up being back again to look at some other posts that you have another time.

Leave a Reply

Your email address will not be published.