When an AASM including class is subclassed, a shallow copy is made of
the StateMachine object. This means that all subclasses share the same
states hash and thus the same set of states, which prevents (among other
things) different subclasses from using the same state names.
Give StateMachine a smart #clone method that copies the states hash and
invoke that rather than #dup upon subclassing.
When AASM is included into a class, it defines inherited, clobbering
the original definition. This problem becomes readily apparent with STI
in Rails, where the original method is part of the implementation of
inheritable attributes, a feature relied on for several ActiveRecord
features such as callbacks and timestamp recording.
Move the implementation of inherited to ClassMethods and invoke the
original method via super.
aasm_event_fired(from, to) - called when an event is fired successfully
aasm_event_failed(event) - called when an event fails
These could be used to implement transition logging [Artem Vasiliev] or
setting a timestamp column [Mike Ferrier] as well as other pieces of love and magic.