Sometimes your controllers get so full of before_filters, after_filters, and around_filters that it’s hard to figure out what order these callbacks are actually executing in. A couple of times recently, I’ve run into some tricky bugs that ended up being related to callbacks running too soon or too late.
Due to some fancy-pants metaprogramming in AbstractController::Callbacks
, it’s hard to see what’s going on.
In Rails 3, send this to Rails.logger.debug
or puts
from inside your controller to see the ordered filter callback chain:
_process_action_callbacks.map(&:filter)
About the Author