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
On 7/11/07, stewbawka <stewbawka-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> 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 received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---