Skip to content
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

Block arguments from transitions are not passed to after_transition blocks #38

Open
nsommer opened this issue Jun 15, 2021 · 1 comment

Comments

@nsommer
Copy link
Member

nsommer commented Jun 15, 2021

Ideally, the following should work:

event :invest do
  transition from: :poor, to: :rich do |transition, stock:|
    ...
  end
end

after_transition from: any_state, to: all_states do |transition, stock:|
  puts "I was #{transition.from} and now I'm #{transition.to} thanks to #{stock}"
end

However, while the stock: keyword argument passed to the #invest method on the state machine is accessible from within the transition block, it is not passed through to the after_transition block.

@getand fyi what we talked about yesterday

@getand
Copy link
Member

getand commented Jun 30, 2021

Would prefer to solve it like documented here: #40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants