Delete a Has-Many Relationship ONLY

元气小坏坏 提交于 2019-12-20 18:26:50

问题


I have a: has_and_belongs_to_many :friends, :join_table => "friends_peoples".

To add a friend I do: @people.followers << @friend which create the relationship and a new person profile.

Now I'd like to delete the relationship ONLY and not the person profile.

I tried @people.friends.delete(guilty.id) but it deletes the person profile and not the relationship.

Any idea?


回答1:


Have you tried this?

@people.friends.delete(guilty)


来源:https://stackoverflow.com/questions/3852017/delete-a-has-many-relationship-only

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!