0
我試圖在參數中傳入,甚至使用aasm紅寶石寶石和導軌。但是,每當我嘗試按照文檔示例進行操作時,我都會收到Wrong number of arguments. Expected 0, got 2.
。我究竟做錯了什麼?Aasm Gem將參數傳入事件
代碼如下:
class Foo < ActiveRecord::Base
include AASM
aasm column: :status do
state :stopped, initial: true
# TODO: if post fails, should this remain in_progress?
state :running
event :run, aasm_fire_event: :do_something do
transitions from: :stopped, to: :running
end
end
def do_something(list_of_things)
.... #stuff here
end
end
,然後調用代碼
foo = Foo.new
foo.run(:running, [param1, param2])
這似乎效仿的榜樣,但我不能得到它的工作。任何幫助,將不勝感激。
你應該看看整個錯誤堆棧跟蹤並檢查你得到錯誤的行號 – dnsh