Do callbacks stop operations in rails
-
02-07-2019 - |
Question
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?
Solution
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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow