You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Document model associated with a Company. When I call @company.destroy, the Company record is lazy-deleted but the Documents are actually deleted.
Thanks for suggestion @rdetert. It will be nice if you can add some failing test. Meanwhile I'll do research how another similar libraries are handling this.
@rdetert I agree this needs to be looked into. I've also found a few cases where I think destroying paranoid docs with other paranoid docs relations can cause infinite recursion.
has_many :documents, dependent: :destroy should work fine since all the models are instantiated first and then the #destroy is applied on each of them, so the entries will still be persisted in mongodb with a field deleted_at.
Nevertheless beware when using has_many :documents, dependent: :delete since the documents would in that case really be deleted since the delete_all is used in that case, which is not compliant with mongoid_paranoia
I have a Document model associated with a Company. When I call @company.destroy, the Company record is lazy-deleted but the Documents are actually deleted.
The text was updated successfully, but these errors were encountered: