これらは私のモデルです
class Product
has_many :line_items
has_many :orders, :through => :line_items
end
class LineItem
belongs_to :order
belongs_to :product
validates :quantity, presence: true
end
class Order
has_many :line_items
has_many :products, :through => :line_items
end
@order.products << @product
製品を注文に関連付けることはできますが、結合テーブルに数量を設定する方法もわかりません。