Changeset [fee9487e0d5464fc328f1c9c91eb059fef75988e] by Tim Pope

October 9th, 2008 @ 07:03 PM

Invoke original inherited callback when subclassed

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. http://github.com/rubyist/aasm/c...

Committed by Tim Pope

  • M lib/aasm.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.