2010-10-03 25 views
12

我有一個:has_and_belongs_to_many :friends, :join_table => "friends_peoples".刪除具有一對多的關係ONLY

要添加好友我做的:@people.followers << @friend其創造的關係,一個新的人的個人資料。

現在我想刪除關係而不是個人資料。

我試過@people.friends.delete(guilty.id),但是它刪除了個人資料而不是關係。

有什麼想法?

回答

24

你試過嗎?

@people.friends.delete(guilty) 
+0

工程!很簡單!非常感謝 – Alextoul 2010-10-05 16:24:58

+5

FYI刪除跳過回調。使用'@ people.friends.destroy(guilty)'讓回調工作。 – meatherly 2013-09-11 23:23:01