Permalink
Browse files

log at debug level what line caused the redirect_to

  • Loading branch information...
1 parent d33eb07 commit 3fa00070047b5d019d39e691598ee2890283d052 @jackdempsey jackdempsey committed Jul 24, 2011
Showing with 1 addition and 0 deletions.
  1. +1 −0 actionpack/lib/action_controller/metal/redirecting.rb
@@ -59,6 +59,7 @@ module Redirecting
def redirect_to(options = {}, response_status = {}) #:doc:
raise ActionControllerError.new("Cannot redirect to nil!") if options.nil?
raise AbstractController::DoubleRenderError if response_body
+ logger.debug { "Redirected by #{caller(1).first rescue "unknown"}" } if logger
@bcardarella

bcardarella May 17, 2012

Contributor

This addition is causing my actionpack test suite to blow up. /cc @tenderlove

@bcardarella

bcardarella May 17, 2012

Contributor

fyi, this is the error I am seeing:

[66, 75] in /Users/bcardarella/projects/rails/actionpack/lib/action_controller/metal/redirecting.rb
   66      # behavior for this case by rescuing ActionController::RedirectBackError.
   67      def redirect_to(options = {}, response_status = {}) #:doc:
   68        raise ActionControllerError.new("Cannot redirect to nil!") unless options
   69        raise AbstractController::DoubleRenderError if response_body
   70        debugger
=> 71        logger.debug { "Redirected by #{caller(1).first rescue "unknown"}" } if logger
   72  
   73        self.status        = _extract_redirect_to_status(options, response_status)
   74        self.location      = _compute_redirect_to_location(options)
   75        self.response_body = "<html><body>You are being <a href=\"#{ERB::Util.h(location)}\">redirected</a>.</body></html>"
/Users/bcardarella/projects/rails/actionpack/lib/action_controller/metal/redirecting.rb:71
logger.debug { "Redirected by #{caller(1).first rescue "unknown"}" } if logger
(rdb:1) logger
#<ActiveSupport::LogSubscriber::TestHelper::MockLogger:0x007f8218d4df40 @flush_count=0, @level=0, @logged={:info=>["Processing by Another::LogSubscribersController#never_executed as HTML"]}>
(rdb:1) logger.debug
ArgumentError Exception: wrong number of arguments (1 for 2)
self.status = _extract_redirect_to_status(options, response_status)
self.location = _compute_redirect_to_location(options)

0 comments on commit 3fa0007

Please sign in to comment.