state-machines / state_machines-audit_trail

Log transitions on a state_machines gem to support auditing and business process analytics.
https://github.com/state-machines/state_machines-audit_trail
MIT License
75 stars 24 forks source link

Context should be created on save #22 #23

Open duleorlovic opened 7 years ago

duleorlovic commented 7 years ago

It seems that context is evaluated on .new instead of .save

ryanseys commented 9 months ago

@seuros could we get a review of this as well? This would fix a MonkeyPatch that we have been using for a while.

ryanseys commented 9 months ago

Our monkeypatch is changing this line from after_initialize to before_create:

https://github.com/state-machines/state_machines-audit_trail/blob/7c7f773e5faaf80dd36c0f48a01cefd713a7dbb1/lib/state_machines/audit_trail/transition_auditing.rb#L57

which it appears this PR is trying to do in a slightly different way?

Perhaps either / both approaches would work, but getting this fixed would be amazing :)