You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I generated a dead loop by calling the executed event event again in the callback after, and found that it was caused by the state not changing. I found that the state did not change from user in the after method_ Pending transformation success manager_ Pending, is the method I used incorrect?
event :approved_to_state do
transitions from: :treasurer_pending, to: :success_state
transitions from: :manager_pending, to: :treasurer_pending
transitions from: :user_pending, to: :manager_pending, after: proc { before_manager_handler }
transitions from: :it_pending, to: :user_pending
transitions from: :leader_pending, to: :it_pending
end
def before_manager_handler
puts self.state
puts "Skip manager_pending“
self.approved_to_state
end
Through printing, it was found that the value of self.state is always user_ pending, so it constantly executes leading to a dead loop
The text was updated successfully, but these errors were encountered:
I think this is because you dont actually save the object until after the after call. In your after call, the object is still in user_pending, then in the after call, you call the event transition, when then sees its in user_pending, then repeats the process. After is keeping the object as is, telling it to do something before saving but after the tranisition happens. Kinda like using a non-bang vs bang in aasm
To provide a solution, I would think these should be their own events;
I generated a dead loop by calling the executed event event again in the callback after, and found that it was caused by the state not changing. I found that the state did not change from user in the after method_ Pending transformation success manager_ Pending, is the method I used incorrect?
Through printing, it was found that the value of self.state is always user_ pending, so it constantly executes leading to a dead loop
The text was updated successfully, but these errors were encountered: