-
Notifications
You must be signed in to change notification settings - Fork 638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Access to firing event in callbacks #168
Comments
Having access to the name of the event would fix #159 too. |
I just released version Take a look at the README: The current event triggeredWhile running the callbacks you can easily retrieve the name of the event triggered # taken the example callback from above
def do_something
puts "triggered #{aasm.current_event}"
end and then job = Job.new
# without bang
job.sleep # => triggered :sleep
# with bang
job.sleep! # => triggered :sleep! Please, let me know if that solves this issue! |
This is perfect, thank you for the work and quick turnaround! ❤️ |
That is awesome! The issue has been solved =) Thank you so much for the effort. |
There does not seem to be a way to access the name of the event that triggered an on_transition callback. We need this for a pubsub to record state changes event (because externally we care about triggered events and internally we care about states). In this case the to_state/from_state is not helpful, we need the particular event. There are a number of ways to hack this in our application and all of them are gross.
This would be a very helpful attribute in our case.
I looked into it a bit and it doesn't seem too hard to add
:current_event
toInstanceBase
but the spec tests do not run (an rspec error) and I don't want to have to set up Mongo (why not sqlite?) and debug them to figure it out.Thanks for the great state machine gem.
The text was updated successfully, but these errors were encountered: