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

Abort transition using around_transition #352

Open
davidpatters0n opened this issue Mar 13, 2017 · 0 comments
Open

Abort transition using around_transition #352

davidpatters0n opened this issue Mar 13, 2017 · 0 comments

Comments

@davidpatters0n
Copy link

Is it possible to abort/halt a transition whilst inside a around_transition. The example I have here is:

around_transition do |cost_item, transition, block|
  if ticket.access_keys.any?(&:full?)
    # abort transition!
    false
  else
    block.call
    ticket.send(:redeem_access_key, transition)
  end
end

Is returning false sufficient. According to the readme and the rubydoc there is no mention of this:

http://www.rubydoc.info/github/pluginaweek/state_machine/StateMachine%2FMachine%3Aaround_transition

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

1 participant