1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00

Update docs to more accurately reflect behaviour

Usage of the word "must" in the current documentation is not accurate, if the first argument to a transition is not a valid end state, end state will be set to `nil` and the arg will be unshifted to the args that get passed to callbacks: cd25a1eeae/lib/aasm/core/event.rb (L135-L139)
This commit is contained in:
James Keys 2019-01-23 10:28:31 +08:00 committed by Anil Kumar Maurya
parent d185921d90
commit 6a1000b489

View file

@ -219,7 +219,7 @@ Also, you can pass parameters to events:
In this case the `set_process` would be called with `:defragmentation` argument.
Note that when passing arguments to a state transition, the first argument must be the desired end state. In the above example, we wish to transition to `:running` state and run the callback with `:defragmentation` argument. You can also pass in `nil` as the desired end state, and AASM will try to transition to the first end state defined for that event.
Note that when passing arguments to a state transition, the first argument should be the desired end state. In the above example, we wish to transition to `:running` state and run the callback with `:defragmentation` argument. You can also omit or pass in `nil` as the desired end state, and AASM will try to transition to the first end state defined for that event.
In case of an error during the event processing the error is rescued and passed to `:error`
callback, which can handle it or re-raise it for further propagation.