revealing the ActionController callback filter chain

February 1, 2011 Nate Clark

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:

About the Author


Pairing in Boulder
Pairing in Boulder

Recently, we have been experimenting with a few new pairing configurations in Boulder, I thought I would sh...

Don't Sweep It Under the Rug
Don't Sweep It Under the Rug

Advice for Rails Performance Optimization Upcoming Launch Recently, our team releasing to a large set of ...

SpringOne 2021

Register Now