search for: answers_quest

Displaying 1 result from an estimated 1 matches for "answers_quest".

2006 Jan 04
4
many to many link table compound primary key explosion
...ink table creates a primary key from the two fields to prevent duplicate records. When I add the same answer to the same question more than once, rails attempts to create a duplicate record and explodes with a MySQL error: MysqlError: Duplicate entry ''3-3'' for key 1: INSERT INTO answers_questions (`question_id`, `answer_id`) VALUES (3, 3) Now, I realise I can fix this by removing the primary key from my schema, and some would say the primary key is unnecessary, but I think Rails'' behaviour is wrong. Any thoughts? MySQL in particular supports "ON DUPLICATE KEY UPDATE&quo...