I have just added qty to a product page.
I think I need to somehow put the button_to into the form, but it's working ok now.
I'd like to pass in an instant variable @remaining into the max form element instead of using a fixed value there now (5).
I think I tried max = "<% @remaining %>", but that didn't work. Not sure how that is passed into a form element.
<form>
Quantity:
<input type="number" name="quantity" value="1" min="1" max= "5" ><br>
</form>
<%= button_to "Add to Cart", { :controller => "products", :action => "add_to_cart", product_id: @product } %>