I just picked up Agile Web Development with Rails 3rd Ed., and I'm going thru the Depot Application chapters, and I have a question about Product/Item options-
If I wanted to modify the product catalog and store so that products could have options (size, color, whatever), where/how would I do that?
Let's say I'm selling t-shirts, and they come in different sizes. I don't feel like that's something that really needs a model created to handle sizes, so I thought I could just add it as a select box in the html in the store's view.
But, each Add to Cart button is wrapped by a form tag that is automatically generated by button_to, and doesn't seem to give me the ability to pass additional parameters to my cart. How can I get the size of the item added into the POST to add_to_cart?
And perhaps more importantly- what is the most Railsy way to do so?
Thanks in advance for any help! --Mark
The helper in my view:
<%= button_to "Add to Cart" , :action => :add_to_cart, :id => product %>
The form that it generates:
<form method="post" action="/store/add_to_cart/3" class="button-to">