Fails to execute initial state callbacks
Reported by Nathaniel Bibler | August 15th, 2008 @ 06:24 PM
If an ActiveRecord object defines an initial state with callbacks (:enter, for example):
class MyClass < ActiveRecord::Base
include AASM
aasm_initial_state :active
aasm_state :active, :enter => :do_activate
aasm_state :inactive
...
AASM fails to execute the callbacks during the initial object creation:
MyClass.create! #=> fails to call :do_activate
Comments and changes to this ticket
-
Brandon Palmen March 27th, 2009 @ 03:55 PM
Yes, the same is true of :after callbacks. The new :on_transition event callbacks are essentially :before.. no good as a replacement for :after.
We need this back: aasm_state :active, :enter => :do_activate, :after => :confirm_activated
In other words: Confirmed.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
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.