这些是我的模型
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
将产品与订单相关联,但我不知道如何在连接表中设置数量。