class Foo < ActiveRecord::Base
has_many: bars, dependent: :destroy
has_one: roo, dependent: :destroy
end
class Bar < ActiveRecord::Base
has_many: bazs, dependent: :destroy
end
class Baz < ActiveRecord::Base
end
class Roo < ActiveRecord::Base
end
我正在尝试Foo
使用以下代码删除,但在从 bar/ 中删除 baz 引用时出现 FK 异常
我的删除语法是否roo
正确?
Foo.delete(foo_id)