aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2017-02-21 11:28:54 +0900
committerGitHub <noreply@github.com>2017-02-21 11:28:54 +0900
commit6df558f2ab87c410a26cb20373d88317ed4b510b (patch)
treecaeb9b322c16e59319eb105c9e015fe61632db25 /actionpack
parent0ce641839aa59d8c8306ec21cfd5f31aaa9b169c (diff)
parentca7799861982e89d1dfc8a06f369b921edccddfa (diff)
downloadrails-6df558f2ab87c410a26cb20373d88317ed4b510b.tar.gz
rails-6df558f2ab87c410a26cb20373d88317ed4b510b.tar.bz2
rails-6df558f2ab87c410a26cb20373d88317ed4b510b.zip
Merge pull request #28081 from meinac/fix_redirect_method
Use `response#location` instead of `#location` in redirect.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/metal/redirecting.rb2
-rw-r--r--actionpack/test/controller/redirect_test.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/metal/redirecting.rb b/actionpack/lib/action_controller/metal/redirecting.rb
index 4dfcf4da28..a349841082 100644
--- a/actionpack/lib/action_controller/metal/redirecting.rb
+++ b/actionpack/lib/action_controller/metal/redirecting.rb
@@ -56,7 +56,7 @@ module ActionController
self.status = _extract_redirect_to_status(options, response_status)
self.location = _compute_redirect_to_location(request, options)
- self.response_body = "<html><body>You are being <a href=\"#{ERB::Util.unwrapped_html_escape(location)}\">redirected</a>.</body></html>"
+ self.response_body = "<html><body>You are being <a href=\"#{ERB::Util.unwrapped_html_escape(response.location)}\">redirected</a>.</body></html>"
end
# Redirects the browser to the page that issued the request (the referrer)
diff --git a/actionpack/test/controller/redirect_test.rb b/actionpack/test/controller/redirect_test.rb
index e4e968dfdb..f06a1f4d23 100644
--- a/actionpack/test/controller/redirect_test.rb
+++ b/actionpack/test/controller/redirect_test.rb
@@ -21,8 +21,8 @@ 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 plain: "called status"; end
- def location; render plain: "called location"; end
+ def status; raise "Should not be called!"; end
+ def location; raise "Should not be called!"; end
def simple_redirect
redirect_to action: "hello_world"