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
Multiple transition behavior is broken when one of the transitions does not have a "from" parameter #392
Comments
Can you mention which version of AASM you are using, I checked on latest version and its working. Our specs for Transition without https://github.com/aasm/aasm/blob/master/spec/models/silencer.rb#L23 https://github.com/aasm/aasm/blob/master/spec/unit/transition_spec.rb#L30 BTW your guards syntax |
@anilmaurya that spec does not test the functionality I'm talking about. I pasted the offending code (the stuff from As for the syntax, the syntax I used is valid since Ruby 1.9.3 and has nothing to do with AASM. If I find some time I can put together a PR for this. |
@lserman Thank you for reporting this bug and explaining in detail. ♡ Somehow I missed multiple transitions in issue and only checked for single transition. I don't know why JSON style condition is throwing syntax error in irb. 🤔 |
@lserman This bug is resolved in latest release i.e |
I want to allow administrators to transition a record to any state. Based on the documentation for "multiple transitions" I thought I could do something like this:
The
AASM::Core::Event#_fire
ends up checking the "from" states if any transitions define it, canceling out the behavior that omitting the "from" argument should allow a transition from any state:The workaround is to define the admin transitions like:
transition to: :state3, from: state_machine.states.map(&:name), if: :admin_override?
The text was updated successfully, but these errors were encountered: