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

Creating a snapshot without persisting the changes to DB #49

Closed fb-justin closed 4 months ago

fb-justin commented 4 months ago

Is there a sanctioned way to save a snapshot without persisting changes to the model itself?

I'm trying to build an Approval workflow, and hitting an issue where create_snapshot! checks that the object is persisted.

Or perhaps there's a better way of going about this workflow?

fb-justin commented 4 months ago

I ended up implementing this with a rollback after creating the transaction.