Topic: Strange habtm table collision issues
I'm really hoping that somebody can help me with this because I'm at a loss. I have a habtm table called clients_ip_matters, and it seems to semi-randomly error out when inserting a record into the JOIN table because it is specifying the primary key (id). Here's the relevant line from production.log
ActiveRecord::StatementInvalid (Mysql::Error: Duplicate entry '1' for key 1: INSERT INTO clients_ip_types (`client_id`, `id`, `ip_type_id`) VALUES (9, 1, 1)):
So, I'm confused as to why the habtm table insert is trying to specify an id of 1. Obviously, this clashes with previous entries in the table. What is going on here?