aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-12-30 14:47:51 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2014-12-30 14:48:10 -0800
commit87a75910640b83a677099198ccb3317d9850c204 (patch)
tree9045169315eb1185b81d4061457672d7eb7d3078 /actionpack
parent77a9486ba66fc873e990f275e6ae1a5b56688f6c (diff)
downloadrails-87a75910640b83a677099198ccb3317d9850c204.tar.gz
rails-87a75910640b83a677099198ccb3317d9850c204.tar.bz2
rails-87a75910640b83a677099198ccb3317d9850c204.zip
use methods on the request rather than direct hash access
this will help decouple us from using the rack env hash
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/metal/url_for.rb4
-rw-r--r--actionpack/lib/action_dispatch/http/request.rb8
2 files changed, 10 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/metal/url_for.rb b/actionpack/lib/action_controller/metal/url_for.rb
index 0f2fa5fb08..847f08c25d 100644
--- a/actionpack/lib/action_controller/metal/url_for.rb
+++ b/actionpack/lib/action_controller/metal/url_for.rb
@@ -30,9 +30,9 @@ module ActionController
:_recall => request.path_parameters
}.merge!(super).freeze
- if (same_origin = _routes.equal?(env["action_dispatch.routes".freeze])) ||
+ if (same_origin = _routes.equal?(request.routes)) ||
(script_name = env["ROUTES_#{_routes.object_id}_SCRIPT_NAME"]) ||
- (original_script_name = env['ORIGINAL_SCRIPT_NAME'.freeze])
+ (original_script_name = request.original_script_name)
options = @_url_options.dup
if original_script_name
diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb
index 2a7bb374a5..b15f37d7f2 100644
--- a/actionpack/lib/action_dispatch/http/request.rb
+++ b/actionpack/lib/action_dispatch/http/request.rb
@@ -105,6 +105,14 @@ module ActionDispatch
@request_method ||= check_method(env["REQUEST_METHOD"])
end
+ def routes # :nodoc:
+ env["action_dispatch.routes".freeze]
+ end
+
+ def original_script_name # :nodoc:
+ env['ORIGINAL_SCRIPT_NAME'.freeze]
+ end
+
def request_method=(request_method) #:nodoc:
if check_method(request_method)
@request_method = env["REQUEST_METHOD"] = request_method