aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-08-14 10:04:14 -0700
committerJosé Valim <jose.valim@gmail.com>2011-08-14 10:04:14 -0700
commit99f87c9ad325e610df6298a1b8dec571cd920230 (patch)
tree9741d9de1ed134ec82b51daa34416c2e2b97fef4 /actionpack
parentbf2b9d2de3f85e880e5afa980e6fd65b1f07557c (diff)
parent75dd33a0aed96d9f03b79c82f7e5bc5ccf462e8e (diff)
downloadrails-99f87c9ad325e610df6298a1b8dec571cd920230.tar.gz
rails-99f87c9ad325e610df6298a1b8dec571cd920230.tar.bz2
rails-99f87c9ad325e610df6298a1b8dec571cd920230.zip
Merge pull request #2527 from cesario/fix_2511
Methods like status and location are interfering with redirect_to [Closes #2511]
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/metal/instrumentation.rb6
-rw-r--r--actionpack/test/controller/redirect_test.rb5
2 files changed, 8 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/metal/instrumentation.rb b/actionpack/lib/action_controller/metal/instrumentation.rb
index 85d0f5f699..777a0ab343 100644
--- a/actionpack/lib/action_controller/metal/instrumentation.rb
+++ b/actionpack/lib/action_controller/metal/instrumentation.rb
@@ -58,8 +58,8 @@ module ActionController
def redirect_to(*args)
ActiveSupport::Notifications.instrument("redirect_to.action_controller") do |payload|
result = super
- payload[:status] = self.status
- payload[:location] = self.location
+ payload[:status] = response.status
+ payload[:location] = response.location
result
end
end
@@ -97,4 +97,4 @@ module ActionController
end
end
end
-end \ No newline at end of file
+end
diff --git a/actionpack/test/controller/redirect_test.rb b/actionpack/test/controller/redirect_test.rb
index 92d4a6d98b..79041055bd 100644
--- a/actionpack/test/controller/redirect_test.rb
+++ b/actionpack/test/controller/redirect_test.rb
@@ -4,6 +4,11 @@ class WorkshopsController < ActionController::Base
end
class RedirectController < ActionController::Base
+ # empty method not used anywhere to ensure methods like
+ # `status` and `location` aren't called on `redirect_to` calls
+ def status; render :text => 'called status'; end
+ def location; render :text => 'called location'; end
+
def simple_redirect
redirect_to :action => "hello_world"
end