Open Startouf opened 6 years ago
I would definitely like this functionality, and I think the linked comment by @wadetandy is the way to go. I'm currently working on transitioning this to graphiti (beta next week) if you'd like to submit a PR there (otherwise will be a little while until I can get to it). Specs here.
When dealing with transactionless operations (MongoDB, ElasticSearch, etc.) it is not possible to redefine the
transaction
, yet it would make sense to have arollback
method that would yield the model that was created or updated (ie the return of thecreate/update
method.Based on that, it would become possible to either
destroy
or just rollback the changes manually (ActiveModel has a niceprevious_changes
builtin method)The idea being that the rollback method would be fired automatically if there is for example a failure while persisting the related resources / sideposting