I’m a newbie, running through a rails tutorial. I’m a bit stuck on
using the img_submit_tag.

<% @products.each do |product| -%>

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

<%=h product.title %>

<%= product.description %>

The <%= link_to image_tag(product.image_url, :border =>0), :action =>
‘add_to_cart’, :id => using the product.image_url as a source and I’d
like to know how I can pass the path to the img_submit_tag.
Thanks, I hope I’m not too confusing in my question

Take normal form and define your controller & action there as url.
Instade of normal submit_tag use image_submit_tag.

<% form_for :url => {:action => ‘add_to_cart’, :id => x} do |f| %>
<%= image_submit_tag(“agree.png”) %>
<% end %>

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs