Skip to content

Passing arguments to callbacks

David Kelly edited this page Feb 21, 2024 · 1 revision

In your AASM section in the class:

event :do_something do
  transitions from: :state_a, to: :state_b

  after do |my_arg|
    call_something(my_arg)
  end
end

To pass this argument simply use the bang syntax as normal, and add the argument.

my_object.do_something!(123)