class OrderItem < ApplicationRecord
belongs_to :productS
Started POST "/order_items" for ::1 at 2016-10-03 21:59:37 +0300
Processing by OrderItemsController#create as JS
Parameters: {"utf8"=>"✓", "order_item"=>{"products"=>{"quantity"=>"6", "product_id"=>"2"}}, "commit"=>"Add to Cart"}
Unpermitted parameter: products
(0.2ms) BEGIN
(0.2ms) ROLLBACK
{"products"=>{"quantity"=>"6", "product_id"=>"2"}}
не совсем понятно, как это должно работать с кол-вом товаров > 1<h3 class="text-center">Products for Sale</h3>
<%= form_for @order_item, remote: true do |f| %>
<%= f.fields_for :multiple_products do |products_form| %>
<% @products.each do |product| %>
<%= product.name %>
Unit Price:<%= number_to_currency product.price %>
<%= products_form.number_field "quantity[]", value: 1, class: "form-control", min: 1 %>
<%= products_form.hidden_field "product_id[]", value: product.id %>
<% end %>
<% end %>
<%= f.submit "Add to Cart", class: "btn btn-primary" %>
<% end %>