Return to Snippet

Revision: 901
at August 20, 2006 22:58 by newtonapple


Updated Code
# this code is for embedded ruby in rhtml:

<%= button_to 'Add to Cart', :action => :add_to_cart, :id => product %>
#  this generates a submit button:
#  <form method="post" action="/store/add_to_cart/3" class="button-to">
#  <div><input type="submit" value="Add to Cart" /></div></form>
#  note id = 3 in this case

#  the following has the same effect as above but w/ image submit button:	
<%= form_tag :action => :add_to_cart, :id => product %>
<%= image_submit_tag product.image_url, :class => 'image-submit' %>
<%= end_form_tag  %>	
#  <form action="/store/add_to_cart/3" method="post">
#  <input class="image-submit" src="/images/auto.jpg?1156046942" type="image" />
#  </form>

Revision: 900
at August 20, 2006 22:51 by newtonapple


Initial Code
	<div class="entry">
		<%= form_tag :action => :add_to_cart, :id => product %>
		<%= image_submit_tag product.image_url, :class => 'image-submit' %>
		<%= end_form_tag  %>
		<h3><%= h(product.title) %></h3>
		<%= product.description %>
		<span class="price"><%= number_to_currency(product.price) %></span>
		<%= button_to 'Add to Cart', :action => :add_to_cart, :id => product %>
	</div>

Initial URL


Initial Description


Initial Title
Ruby On Rails Form Helper with Image Submit Button

Initial Tags
ruby

Initial Language
Ruby