I've got a model named Song with
has_many :genre_songs, :dependent => :destroy
I've got a join model GenreSong (with genre_id and song_id) that I want to destroy when the Song records are deleted.
It appears that rails is looking for a primary key to delete in the GenreSong model, since I get this error:
Mysql::Error: Unknown column 'id' in 'where clause': DELETE FROM `genre_songs` WHERE `id` = NULL
Is there another way to do this (I would think deleting on song_id would be enough)? By specifying what id the delete should be performed on.
Maybe my SQL is off, but it seems wrong to me to have an extra primary key in a joins table that should consist only of two other primary keys.