I've been trying to debug test failures when converting my project to rails 3, and I noticed that controllers are redirecting inside of before filters. It's very difficult to figure out which of my 8 before_filters caused the unexpected redirect, however, since the "filter chain halted as XXX rendered or redirected" message is MIA. I read through the new ActiveSupport::Callbacks code and see that it would be difficult to instrument in this way.
Temporarily, I added this:
filter = <<-RUBY_EVAL unless halted result = #{@filter} halted = (#{chain.config[:terminator]}) Rails.logger.debug("Filter chain #{@kind.to_s} halted: #{@filter}") if halted end RUBY_EVAL
But I know that's not even going to be syntactically valid in a lot of cases, and ActiveSupport::Callbacks shouldn't even use the Rails.logger. Anybody got any ideas here? This feature was really valuable in debugging requests terminating in unexpected filters...
-David Stevenson Pivotal Labs