Open btrd opened 5 years ago
@btrd , Thank you for your PR.
I have some remarks about this change.
:destroy
will load every single instance of the change and destroy them one by one.
If a record has thousands of changes , that could be a very expensive and slow process.
:delete_all
will delete all the records with 1 SQL query.
The best approach i can think of now, is to delegate this to the database by have a constraint : on_delete: :cascade
on the foreign key.
I still think we can add this feature if we can make it configurable.
The foreign key approach will work only in Relational databases. MongoDB will still need this IFAIK.
Fix this issue https://github.com/state-machines/state_machines-audit_trail/issues/14