diff options
author | speckins <speckins@users.noreply.github.com> | 2018-08-27 22:36:39 -0500 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2018-08-27 22:36:39 -0500 |
commit | 1353610ff2ab4d16d022d5c31d5b4e5d908e05a8 (patch) | |
tree | e15a6aaf0342134748b997b4c8a9559d63436f67 /actionpack/lib/action_controller | |
parent | 626958ce98aece8c3ac6576cb92d24423a9fadaf (diff) | |
download | rails-1353610ff2ab4d16d022d5c31d5b4e5d908e05a8.tar.gz rails-1353610ff2ab4d16d022d5c31d5b4e5d908e05a8.tar.bz2 rails-1353610ff2ab4d16d022d5c31d5b4e5d908e05a8.zip |
Call block to #redirect_to in controller context (#33735)
* Call block to #redirect_to in controller context
The documentation for ActionController::Redirecting states that a Proc
argument "will be executed in the controller's context." However,
unless #instance_eval is used (removed in 6b3ad0ca), that statement is
false for procs defined outside of the controller instance.
This commit restores the documented behavior.
Fixes #33731.
* Move test proc into a constant in another class
Per @rafaelfranca's suggestion.
[Steven Peckins + Rafael Mendonça França]
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/metal/redirecting.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/metal/redirecting.rb b/actionpack/lib/action_controller/metal/redirecting.rb index 4c2b5120eb..2804a06a58 100644 --- a/actionpack/lib/action_controller/metal/redirecting.rb +++ b/actionpack/lib/action_controller/metal/redirecting.rb @@ -105,7 +105,7 @@ module ActionController when String request.protocol + request.host_with_port + options when Proc - _compute_redirect_to_location request, options.call + _compute_redirect_to_location request, instance_eval(&options) else url_for(options) end.delete("\0\r\n") |