Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Fails to execute initial state callbacks

#6

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

Reported by Nathaniel Bibler · August 15th, 2008 @ 06:24 PM

State: new
Milestone: none
Assigned to: Scott Barron Scott Barron

Activity

  1. Brandon Palmen
    Brandon Palmen

    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.

    March 27th, 2009 @ 03:55 PM

  2. Travis Tilley

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.