Saving HABTM with extra fields?

后端 未结 6 1415
一整个雨季
一整个雨季 2020-12-01 17:32

I am trying to save an order, and the products in the order.

The order is being saved, but the products are not.

I have an orders table and a

6条回答
  •  独厮守ぢ
    2020-12-01 18:25

    It could be that your orders_products table does not have it's own primary key. You will get this error unless your table looks something like this

    CREATE TABLE orders_products (
      id integer,
      order_id integer,
      product_id integer,
      ...
    

    I only just now had this same problem. Sorry such a simple answer did not get to you sooner.

提交回复
热议问题