Detaching a referenced record from a 1..N relationship, without deleting it
I have a 1..N relationship between two classes
class A
has_many: bees
class B
belongs_to: a
I can add instances of B to bees
collection without problem.
When I try to remove a specific instance of B, by doing
a.bees.where( id: someid ).delete
then a gets deleted...
Also tried
b.a.delete
with t开发者_高级运维he same outcome How do I just delete the relationship, leaving the instances intact?
USe the nullify method.
精彩评论