Re: Image_tag problem

Maxim Kulkin
Thu, 28 Sep 2006 10:22:44 -0000

On 28 September 2006 13:56, Mark wrote:
> <%= link_to image_tag(''<%= product.image_url
%>''),   :action
=> :add_to_cart, :id => product  %>
>
> If I replace <%= product.image_url %> with static text e.g.
> /images/17.jpg the line of code works but I need to change the image
> for each db record.

The line should be as follows:

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

You see, you have already opened <%= %> braces, so another pair will not
be
evaluated. Also, there is no need for such complex transformations.