…od name already (such as 'new') Signed-off-by: Scott Barron <email@example.com>
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.
…hem to the StateMachine object.
…tance on AASMs