-
Notifications
You must be signed in to change notification settings - Fork 636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
after_commit callback not firing on initial state #112
Comments
Unfortunately, the concept of aasm do
state :sleeping, :initial => true
state :running
state :failed, :after_enter => :fail
event :run, :after_commit => :change_name! do
transitions :to => :running, :from => :sleeping
end
event :sleep, :after_commit => :yawn do
transitions :to => :sleeping, :from => :running
end
event :fail do
transitions :to => :failed, :from => [:sleeping, :running]
end
end although the current implementation is different from that. Since there is no initial event triggered, there is no Another confusion might come from the fact that AAM So, please bear with me, and don't expect the I will use this issue as a reminder to change the state and event definitions in version 4. |
Our work-around for this was to use a Rails after_commit hook: after_commit :yawn, :if => Proc.new{ |s| s.state_previously_changed? && s.sleeping? } Kind of hacky, but it will work until we can hook into the initial event. |
I'm afraid you got me wrong. I just said I will move the |
I wrote a failing spec that exposes the bug:
In
spec/models/validator.rb
In
spec/unit/persistence/active_record_persistence_spec.rb
The text was updated successfully, but these errors were encountered: