AASM
젬을 사용하여 특정 오브젝트를 다른 상태로 전환하는 레일즈 앱에서 작업하고 있습니다.레일스 AASM 자동 상태 천이
"승인"의 초기 상태는 "허용"속성이 false로 설정된 경우에만 필요합니다. AASM
gem을 사용하여 자동 전환을 수행 할 수 있습니까? 호출하는 순서와 함께, 당신은 모든 가능한 콜백의 목록을 볼 수 있습니다
aasm column: :status do
state :pre_approval, initial: true
state :pending
state :opened
state :closed
event :approved do
transitions from: :pre_approval, to: :pending, guard: :approved_changed?
end
event :received, after: Proc.new { set_received_date } do
transitions from: :pending, to: :opened
end
event :complete, after: Proc.new { set_completion_date } do
transitions from: :opened, to: :closed
end
end
'accept' 속성이'true'로 바뀔 때마다'status' 칼럼이'AASM'에 의해 자동으로'pending'으로 설정되기를 원합니다. – alto