Changeset [d59dbbf6b0db2f07a4f0175f6de46aef832ecba5] 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...

Committed by Tim Pope

  • M lib/aasm.rb
  • M lib/state_machine.rb
  • M spec/unit/aasm_spec.rb
New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Library for adding state machines to Ruby classes. Includes persistence layers for things like ActiveRecord. Formerly known as acts_as_state_machine.