button_to or link_to using an image?

I'm trying to link to action using an image. This is what I'm working

  <img src="<%= product.image_url %>" />
  <%= button_to ('Details', :action => 'details', :id => product ) %>

Is there a good way to make the *image* the clickable item? Any
insights into button_to, and link_to that you want to share are

<%= link_to image_tag(product.image_url), :action => 'details', :id =>
product %>

Thanks a lot!

Is that basically a nested method?

This is the same, but more readable. You pass the image as first parameter to the link_to method. The one posted before was simply omitting parenthesis:

<%= link_to(image_tag(product.image_url), :action => ‘details’, :id =>
product) %>

which is better without parenthesis because it more legible, right?

Rodrigo Alvarez Fernández wrote: