Button_to or link_to using an image?

I’m trying to link to action using an image. This is what I’m working
with:

<%= 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
appreciated.

On 27 November 2006 14:05, Brandon wrote:

I’m trying to link to action using an image. This is what I’m working
with:

<%= 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
appreciated.

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

Thanks a lot!

Is that basically a nested method?

On 11/27/06, Brandon [email protected] wrote:

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?