aasm / aasm/aasm

Wildcard transition breaks aasm.from_state

Open
#513 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
5.2k
Forks
644
PR merge metrics
No merged PRs in 30d

Description

Events defined like this:

event :foo do
  transition to: :bar, after: -> {
    puts "event: #{aasm.current_event} | #{aasm.from_state} -> #{aasm.to_state}"
  }
end

will result in empty aasm.from_state

pry(main)> statable.foo!
event: foo |  -> :bar

I believe it's not intended and compromise state flow consistency

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the event and wildcard transition shown in the report, then trace how aasm.from_state is populated during the transition callback. Done means the callback reports the prior state instead of an empty value; add or update a regression test for this behavior if the existing test suite has coverage for state transitions.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.