Changeset [d59dbbf6b0db2f07a4f0175f6de46aef832ecba5] by Tim Pope
Revision d59dbbf6b0db2f07a4f0175f6de46aef832ecba5,
committed by Tim Pope
· November 5th, 2008 @ 11:06 AM
Allow duplicate state names in subclasses
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. http://github.com/rubyist/aasm/c...
3 changed files
-
M
lib/aasm.rb -
M
lib/state_machine.rb -
M
spec/unit/aasm_spec.rb