after_create with multiple methods?
You can also call a single method and orchestrate the order right on the method.
after_create :process
def process
do_this
do_that
then_this
end
I personally prefer this approach. No hidden magic.
No need to surround the methods in array. Simply use:
after_create :do_this, :and_then_this
Bonus Information:
If a before_*
callback returns false, all the later callbacks and the associated action are cancelled. If an after_*
callback returns false, all the later callbacks are cancelled. Callbacks are generally run in the order they are defined, with the exception of callbacks defined as methods on the model, which are called last.
Why putting the two callback methods into an array?
after_create :do_this, :do_that