Hey,
So I have a HABTM relationship between story and genre with a join
table genres_stories. From what I can tell the first story I add
genres to works fine, but when I try to add genres to a second stroy I
get the following error:
PRIMARY KEY must be unique: INSERT INTO genres_stories ("genre_id",
"story_id", "id") VALUES (1, 2, 1)
Hey,
So I have a HABTM relationship between story and genre with a join
table genres_stories. From what I can tell the first story I add
genres to works fine, but when I try to add genres to a second stroy I
get the following error:
PRIMARY KEY must be unique: INSERT INTO genres_stories ("genre_id",
"story_id", "id") VALUES (1, 2, 1)
If you've got hatbm (as opposed to has many through) you don't want an
id column.
A join table doesn't typically require a primary key id field. If you
disagree then you at least need to base it on a sequence or some other
auto-incrementing feature of your database.