aasm ruby gem と rails を使用して、パラメーターをイベントに渡そうとしています。ただし、ドキュメントの例に従おうとすると、エラーが発生しますWrong number of arguments. Expected 0, got 2.
。私は何を間違っていますか?
コードは以下のとおりです。
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])
これは例に従っているようですが、動作させることができません。どんな助けでも大歓迎です。