I have a model OrderUser and a model Venue, both are related through a
HABTM to relationship and the join table is order_users_venues with
the two foreign keys venue_id and order_user_id. I am trying to add
venues to a user, it works fine if one user is doing this, but if
another is it reinserts the same ids into the table and screws
everything up:
Mysql::Error: Duplicate entry ‘1’ for key 1: INSERT INTO
order_users_venues
(venue_id
, id
, order_user_id
) VALUES (1, 1,
2)
This ‘1’ is entry 3 in the table.
Obviously I am not using HABTM correctly or am using it when it I
shouldn’t be.
Please advise!
Thanks,
John