如何在AASM中调用状态更改的方法?
在下面的模型中,当状态转换为paid时,我想调用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发布于 2008-10-30 15:48:18
算了--算出来了:
aasm_state :paid, :enter => :update_foohttps://stackoverflow.com/questions/250685
复制相似问题