views:

225

answers:

1

If a callback handler returns false, does it cause only the handlers for that callback to not be called, or does it cause the remaining callbacks in that handler and all subsequent callbacks to not be called as well?

+5  A: 

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.

cf http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html

Airsource Ltd