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

52 lines
1.3 KiB
Text
Raw Permalink Normal View History

2013-12-16 16:38:29 -05:00
callbacks
2014-09-09 17:02:11 -04:00
AASM 3
2013-12-16 16:38:29 -05:00
begin
old_state exit # old? should be deprecated -> use old_state.before_exit instead
event before
old_state before_exit
new_state before_enter
new_state enter # old? should be deprecated -> use new_state.before_enter instead
...update state...
transition guard
2014-09-09 17:02:11 -04:00
event guard
transition on_transition
event success # if persist successful
old_state after_exit
new_state after_enter
event after
rescue
event error
end
AASM 4
todo
done
- move event.before before everything else
- move old_state.before_exit before old_state.exit
- move event.guard before transition.guard
- fire guards before running state callbacks (test run)
begin
event before
event guard # test run
transition guard # test run
old_state before_exit
old_state exit
new_state before_enter
new_state enter
event guard
transition guard
2013-12-16 16:38:29 -05:00
transition on_transition
2014-09-09 17:02:11 -04:00
...update state...
2013-12-16 16:38:29 -05:00
event success # if persist successful
old_state after_exit
new_state after_enter
event after
rescue
event error
2014-09-09 17:02:11 -04:00
end