aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-12-30 15:18:20 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2014-12-30 15:18:20 -0800
commit4080dd2f244e7c4d140f8724c2075102ea9db36e (patch)
tree7632a2535f2ea682802a341351b83ac25b956d2d /actionpack
parent87a75910640b83a677099198ccb3317d9850c204 (diff)
downloadrails-4080dd2f244e7c4d140f8724c2075102ea9db36e.tar.gz
rails-4080dd2f244e7c4d140f8724c2075102ea9db36e.tar.bz2
rails-4080dd2f244e7c4d140f8724c2075102ea9db36e.zip
stop referencing `env` in url_for
encapsulate env in the request so that we can eventually move away from the env hash
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/metal/url_for.rb2
-rw-r--r--actionpack/lib/action_dispatch/http/request.rb4
2 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/metal/url_for.rb b/actionpack/lib/action_controller/metal/url_for.rb
index 847f08c25d..572d1770f7 100644
--- a/actionpack/lib/action_controller/metal/url_for.rb
+++ b/actionpack/lib/action_controller/metal/url_for.rb
@@ -31,7 +31,7 @@ module ActionController
}.merge!(super).freeze
if (same_origin = _routes.equal?(request.routes)) ||
- (script_name = env["ROUTES_#{_routes.object_id}_SCRIPT_NAME"]) ||
+ (script_name = request.engine_script_name(_routes)) ||
(original_script_name = request.original_script_name)
options = @_url_options.dup
diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb
index b15f37d7f2..d211ea2b77 100644
--- a/actionpack/lib/action_dispatch/http/request.rb
+++ b/actionpack/lib/action_dispatch/http/request.rb
@@ -113,6 +113,10 @@ module ActionDispatch
env['ORIGINAL_SCRIPT_NAME'.freeze]
end
+ def engine_script_name(_routes) # :nodoc:
+ env["ROUTES_#{_routes.object_id}_SCRIPT_NAME"]
+ end
+
def request_method=(request_method) #:nodoc:
if check_method(request_method)
@request_method = env["REQUEST_METHOD"] = request_method