AAMS로 상태 변경에 대한 방법을 호출합니다
-
05-07-2019 - |
문제
AAMS의 상태 변화에 관한 방법을 부르는 방법은 무엇입니까?
상태가 다음 모델에서 지불되면 update_foo에 전화하고 싶습니다.
class Foo < ActiveRecord::Base
include AASM
# State Machine
aasm_initial_state :incomplete
aasm_state :incomplete
aasm_state :paid
aasm_event :pay do
transitions :from => :incomplete, :to => :paid
end
def update_foo
...
end
end
해결책
Nevermind- 알아 냈습니다.
aasm_state :paid, :enter => :update_foo
제휴하지 않습니다 StackOverflow