I have a "has_and_belongs_to_many" relationship between two tables, meaning I have a join table that contains the two ids of each table. For simplicity let's call them "foo" and "bar". I want to delete a bar from a foo but not actually delete the bar itself. foo = Foo.find(1) bar = Bar.find(1) foo.bars << bar foo.bars.delete(bar) # actually deletes the bar record which I don't want so what should I do to remove the association, but retain the bar record? thanks
on 2008-12-15 02:32
on 2008-12-15 05:54
But the above wont delete the bar record But delete only the association.