dimanche 21 octobre 2018

How to add items to cart by using ruby checkboxes

I am trying to add a selection of items to cart based on their check box status.

For the view I have:

<% @ingredients.each do |ingredient| %>
<%= check_box_tag(:ingredient_id) %> 
<%= label_tag(:ingredient_id, ingredient.title) %>

How can I then add the checked ones to the cart?




Aucun commentaire:

Enregistrer un commentaire