Circular dependent: :destroy in ActiveRecord possible?
Is it safe to have circular dependent: :destroy options in ActiveRecord
models?
class Student < ActiveRecord::Base
has_one :user, dependent: :destroy
end
class User < ActiveRecord::Base
belongs_to :student, dependent: :destroy
end
If I delete a user, it should delete the associated student. And vice-versa.
No comments:
Post a Comment