Displaying 1 result from an estimated 1 matches for "medication_dose_frequencies".
2006 May 17
10
HABTM << producing incorrect insert sql ?
...ysql produce the
auto_increment''ed PK.
## @medication_dose holds a validated, saved model
@medication_dose.medication_frequencies << MedicationFrequency.find
(:all)
The above bails with,
Mysql::Error: #23000Duplicate entry ''1'' for key 1: INSERT INTO
medication_dose_frequencies (`medication_frequency_id`, `id`,
`medication_dose_id`) VALUES (1, 1, 354)
The problem is that the primary key (''id'') is duplicated. This is
happening because the sql generated by rails is not utilizing is not
using the auto_increment (verified as a mysql insert will wor...