state_machines-activerecord
state_machines-activerecord copied to clipboard
Is it possible to configure `after_transition` to occur after the `after_commit` callback?
It would be nice to be able to perform the after_transition
callback after the after_commit
callback.
There's an issue where if your after_transition
starts a job, the model is retrieved via GlobalID and if your job is ran quickly, the model may not have been saved yet, thus leading to a race condition.
https://github.com/state-machines/state_machines-activerecord/blob/8b5ee569b9a041bdafcbad5c646ee501a8c3bd83/lib/state_machines/integrations/active_record.rb#L305