Browse files

Merge pull request #28081 from meinac/fix_redirect_method

Use `response#location` instead of `#location` in redirect.
  • Loading branch information...
guilleiguaran committed Feb 21, 2017
2 parents 0ce6418 + ca77998 commit 6df558f2ab87c410a26cb20373d88317ed4b510b
@@ -56,7 +56,7 @@ def redirect_to(options = {}, response_status = {})
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>"
# Redirects the browser to the page that issued the request (the referrer)
@@ -21,8 +21,8 @@ def to_s
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"

0 comments on commit 6df558f

Please sign in to comment.