aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorbrainopia <brainopia@evilmartians.com>2015-01-15 16:26:50 +0300
committerbrainopia <brainopia@evilmartians.com>2015-01-21 23:53:38 +0300
commitee6e13f3da11b21f3966e009b681d05c65f79c9e (patch)
treeb65687b71ad2b041da6c9ebabef3e4fcf2f9b30b /actionpack/lib
parent3f96b6973b82ad17e443dd1d21be05996fb6fbf0 (diff)
downloadrails-ee6e13f3da11b21f3966e009b681d05c65f79c9e.tar.gz
rails-ee6e13f3da11b21f3966e009b681d05c65f79c9e.tar.bz2
rails-ee6e13f3da11b21f3966e009b681d05c65f79c9e.zip
Add `ActionController::Metal#set_request!`
Add `ActionController::Metal#set_request!` to set a request on controller instance without calling dispatch.
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/metal.rb8
-rw-r--r--actionpack/lib/action_controller/metal/rack_delegation.rb4
2 files changed, 8 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/metal.rb b/actionpack/lib/action_controller/metal.rb
index 993f8e150d..ae111e4951 100644
--- a/actionpack/lib/action_controller/metal.rb
+++ b/actionpack/lib/action_controller/metal.rb
@@ -190,11 +190,15 @@ module ActionController
end
def dispatch(name, request) #:nodoc:
+ set_request!(request)
+ process(name)
+ to_a
+ end
+
+ def set_request!(request) #:nodoc:
@_request = request
@_env = request.env
@_env['action_controller.instance'] = self
- process(name)
- to_a
end
def to_a #:nodoc:
diff --git a/actionpack/lib/action_controller/metal/rack_delegation.rb b/actionpack/lib/action_controller/metal/rack_delegation.rb
index 545d4a7e6e..82054880e9 100644
--- a/actionpack/lib/action_controller/metal/rack_delegation.rb
+++ b/actionpack/lib/action_controller/metal/rack_delegation.rb
@@ -8,9 +8,9 @@ module ActionController
delegate :headers, :status=, :location=, :content_type=,
:status, :location, :content_type, :response_code, :to => "@_response"
- def dispatch(action, request)
+ def set_request!(request) #:nodoc:
+ super
set_response!(request)
- super(action, request)
end
def response_body=(body)