Skip to content

Abort transition using around_transition #352

Open
@davidpatters0n

Description

@davidpatters0n

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions