I have an HTML image tag, but how do I wrap it in a rails erb link_to element?
<img src="/images/index_promo_long.png" alt="Promo Image" /> <- how do I link this with link_to
I have an HTML image tag, but how do I wrap it in a rails erb link_to element?
<img src="/images/index_promo_long.png" alt="Promo Image" /> <- how do I link this with link_to
image <%= image_tag(“/images/blah/blah”, :alt => “Promo Image”) %>
link_to_image <%= link_to(image_tag(“/images/blah/blah”, :alt => “Promo Image”), stuff to build link) %>
Have you tried the following? I would also check out link_image_to().
link_to(image_tag("/images/index_promo_long.png", :alt => "Promo Image"), "http://www.example.com")
or
link_image_to("/images/index_promo_long.png", "http:// www.example.com", :alt => "Promo Image")
The first form is correct. The second form is deprecated.