0
state
에서 다른 하나로 이동하기 위해 AFS state machine
을 사용하려고합니다. 그러나 issue
은 statemachine
이 호출하지 않고 모두 states
을 통해 이동한다는 것입니다. 내가 Booking.create
할 경우 다음 코드는 여기에statemachine 상태는 항상 초기 상태 대신 마지막 상태를 반환합니다.
include AASM
aasm column: 'state' do
state :pending, initial: true
state :checked_in
state :checked_out
event :check_in do
transitions from: :pending, to: :checked_in, guard: :verify_payment?
end
event :check_out do
transitions from: :checked_in, to: :checked_out
end
end
def verify_payment?
self.payment_status=="SUCCESS"
end
을 사용하고있다조차 처음 대신 예상 pending
의 checked_out
상태로 반환 왜 그 대신 initial
의 last
예상되는 상태를 반환?