westonganger / active_snapshot

Simplified snapshots and restoration for ActiveRecord models and associations with a transparent white-box implementation
MIT License
103 stars 16 forks source link

Question about `has_snapshot_children` and reloading `self` #8

Closed pjmartorell closed 2 years ago

pjmartorell commented 2 years ago

In the documentation there is an example where has_snapshot_children reloads self from the database instead of using the instance that is already in memory. What is the reasoning behind this? Is it intended to avoid versioning associated records that are in memory and not persisted? or is it intended to take advantage of the eager-loading? or both things? https://github.com/westonganger/active_snapshot/blob/23a769fbe1f42adecbb81edf015a0c5fc518767d/README.md#L89-L90

Thanks in advance for the clarification

westonganger commented 2 years ago

To take advantage of the eager loading but also gives a guaranteed clean slate.

westonganger commented 2 years ago

If you want to improve this comment feel free.