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’}  %>

2 Comments

Add a Comment

Your email address will not be published. Required fields are marked *