K
K
kstepanovdev2016-10-10 12:16:00
Ruby on Rails
kstepanovdev, 2016-10-10 12:16:00

How to implement add to cart for multiple items?

Guys, help me out.
Tell me how to implement adding goods to the cart for, say, three standard models of the Order, OrderItem, Product type.
In general, how does adding to the cart usually work? For each product, a form is generated with a field for specifying the quantity of the product (quantity), a hidden field for the id, and, in fact, submit.
The task is to add all products to the cart at once, for which the value of the quantity field is not equal to zero. That is, adding not each product separately, but the whole heap with a single button.
I tried through nested_attributes, but either the skis do not go, or I ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
powato, 2016-10-20
@powato

Use inheritance

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question