Displaying 1 result from an estimated 1 matches for "medicationfrequency".
2006 May 17
10
HABTM << producing incorrect insert sql ?
...gs railsers -
I''m trying to add to a collection through HABTM, but the sql
insert is trying to insert a PK rather than letting mysql 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 dup...