Skip to content
This repository
Browse code

Methods like status and location are interfering with redirect_to [Cl…

…oses #2511]
  • Loading branch information...
commit 75dd33a0aed96d9f03b79c82f7e5bc5ccf462e8e 1 parent bf2b9d2
Franck Verrot authored August 14, 2011
6  actionpack/lib/action_controller/metal/instrumentation.rb
@@ -58,8 +58,8 @@ def send_data(data, options = {})
58 58
     def redirect_to(*args)
59 59
       ActiveSupport::Notifications.instrument("redirect_to.action_controller") do |payload|
60 60
         result = super
61  
-        payload[:status]   = self.status
62  
-        payload[:location] = self.location
  61
+        payload[:status]   = response.status
  62
+        payload[:location] = response.location
63 63
         result
64 64
       end
65 65
     end
@@ -97,4 +97,4 @@ def log_process_action(payload) #:nodoc:
97 97
       end
98 98
     end
99 99
   end
100  
-end
  100
+end
5  actionpack/test/controller/redirect_test.rb
@@ -4,6 +4,11 @@ class WorkshopsController < ActionController::Base
4 4
 end
5 5
 
6 6
 class RedirectController < ActionController::Base
  7
+  # empty method not used anywhere to ensure methods like
  8
+  # `status` and `location` aren't called on `redirect_to` calls
  9
+  def status; render :text => 'called status'; end
  10
+  def location; render :text => 'called location'; end
  11
+
7 12
   def simple_redirect
8 13
     redirect_to :action => "hello_world"
9 14
   end

0 notes on commit 75dd33a

Please sign in to comment.
Something went wrong with that request. Please try again.