/ Published in: Ruby
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
# 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>