how to delete record with no primary key

Hi,

recordvar.destroy doesn't work.. gives me the following error:

Unknown column 'id' in 'where clause'

there's gotta be a way to delete entries in a link table.. any help?

thanks,

Stuart

you example begs the question how are you instantiating a record from a join table without an id in the first place?

typically these tables will not have an id column and therefore no model to go along with it. this is what you would see in a habtm relationship. the table is in a sense invisible and it's only purpose is tho join (or link, in your words) two other tables. of course, a has_many through join is different, as the join table does have a representative model.

left table <-- join table --> right table

what you are attempting to do in this case is destroy the relationship between 2 tables, which is easy enough, but you have to do it through one of the two models representing either the left or right tables.

ie

thing habtm doohickeys doohickey habtm things

# say t and d have a relationship in the join table t = Thing.find(first) d = Doohickey.find(first)

t.doohickeys.delete(d) # or # d.things.delete(t) # will work as well