2009-05-27 04:40:43 -04:00
|
|
|
module ActionController
|
2009-12-20 21:05:26 -05:00
|
|
|
module RackDelegation
|
2009-05-28 12:35:36 -04:00
|
|
|
extend ActiveSupport::Concern
|
2009-05-28 10:49:02 -04:00
|
|
|
|
2009-05-27 04:40:43 -04:00
|
|
|
included do
|
2009-12-20 21:00:04 -05:00
|
|
|
delegate :session, :reset_session, :to => "@_request"
|
2009-06-15 14:21:08 -04:00
|
|
|
delegate :headers, :status=, :location=, :content_type=,
|
2009-05-27 04:40:43 -04:00
|
|
|
:status, :location, :content_type, :to => "@_response"
|
2009-08-25 15:14:31 -04:00
|
|
|
attr_internal :request
|
2009-05-27 04:40:43 -04:00
|
|
|
end
|
2009-05-28 10:49:02 -04:00
|
|
|
|
2009-11-05 18:38:04 -05:00
|
|
|
def dispatch(action, env)
|
2009-05-27 04:40:43 -04:00
|
|
|
@_request = ActionDispatch::Request.new(env)
|
|
|
|
@_response = ActionDispatch::Response.new
|
|
|
|
@_response.request = request
|
|
|
|
super
|
|
|
|
end
|
2009-05-28 10:49:02 -04:00
|
|
|
|
2009-05-27 04:40:43 -04:00
|
|
|
def params
|
|
|
|
@_params ||= @_request.parameters
|
|
|
|
end
|
2009-05-28 10:49:02 -04:00
|
|
|
|
2009-05-27 04:40:43 -04:00
|
|
|
def response_body=(body)
|
|
|
|
response.body = body if response
|
|
|
|
super
|
|
|
|
end
|
|
|
|
end
|
2009-05-28 10:49:02 -04:00
|
|
|
end
|