I am trying to pass parameters into my event using the aasm ruby gem and rails. However, whenever I try to follow the example in the documentation, I get the error Wrong number of arguments. Expected 0, got 2.
. What am I doing wrong?
Code is below:
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
and then the calling code
foo = Foo.new
foo.run(:running, [param1, param2])
This seems to follow the example, but I can't get it to work. Any help would be appreciated.