1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Methods like status and location are interfering with redirect_to [Closes #2511]

This commit is contained in:
Franck Verrot 2011-08-14 18:58:29 +02:00
parent bf2b9d2de3
commit 75dd33a0ae
2 changed files with 8 additions and 3 deletions

View file

@ -58,8 +58,8 @@ module ActionController
def redirect_to(*args) def redirect_to(*args)
ActiveSupport::Notifications.instrument("redirect_to.action_controller") do |payload| ActiveSupport::Notifications.instrument("redirect_to.action_controller") do |payload|
result = super result = super
payload[:status] = self.status payload[:status] = response.status
payload[:location] = self.location payload[:location] = response.location
result result
end end
end end

View file

@ -4,6 +4,11 @@ class WorkshopsController < ActionController::Base
end end
class RedirectController < ActionController::Base 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 def simple_redirect
redirect_to :action => "hello_world" redirect_to :action => "hello_world"
end end