我的活动签名是
event :accepted do
transitions :from => :created, :to => :scheduled, :on_transition => :driver_accepted_ride, :after => :notify_scheduled
end
转换回调是
def driver_accepted_ride( driver )
Rails.logger.debug 'on transition driver accepted ride'
self.driver = driver
self.car = driver.car
save
end
并称为
ride.accepted(driver)
然而我收到了错误:
Event 'accepted' cannot transition from 'created'
为什么会这样?删除on_transition
回调允许转换继续进行。我想将值传递给on_transition
回调。