ruby on rails - link_to image_tag add Link -


this question has answer here:

i trying add link image doesnt sure how should it. have currently.

<%= link_to image_tag product.photo.url(:thumb) if product.photo.present? %><br/> 

i want have same link 'show'

<%= link_to 'show', product %><br/> 

any advise how it? trying clear confusion might seem duplicate of question. trying link product image own product information page instead of image link itself.

i managed solve own question using this. hope looking similar solution.

<%= link_to image_tag(product.photo.url(:thumb)), product if product.photo.present? %><br/>