pluginaweek / state_machine

Adds support for creating state machines for attributes on any Ruby class
http://www.pluginaweek.org
MIT License
3.74k stars 505 forks source link

Is it possible to add a callback to an event after the fact? #357

Closed kevinnio closed 4 years ago

kevinnio commented 6 years ago

Let's say we have a properly defined state machine that operates on the attribute state of a Rails model. Is there a way to add a new callback like after_transition to: :some_state, do: :my_callback but from outside the class and without modifying the original state machine definition?