From bd6b61be88dfe6eb1ff1dcc5c17542d804a842c7 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Thu, 6 Aug 2009 19:52:11 -0300 Subject: Rename /base to /metal and make base.rb and metal.rb top-level to reflect their module locations --- .../action_controller/metal/rack_convenience.rb | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 actionpack/lib/action_controller/metal/rack_convenience.rb (limited to 'actionpack/lib/action_controller/metal/rack_convenience.rb') diff --git a/actionpack/lib/action_controller/metal/rack_convenience.rb b/actionpack/lib/action_controller/metal/rack_convenience.rb new file mode 100644 index 0000000000..805157b0e3 --- /dev/null +++ b/actionpack/lib/action_controller/metal/rack_convenience.rb @@ -0,0 +1,33 @@ +module ActionController + module RackConvenience + extend ActiveSupport::Concern + + included do + delegate :headers, :status=, :location=, :content_type=, + :status, :location, :content_type, :to => "@_response" + attr_internal :request, :response + end + + def call(name, env) + @_request = ActionDispatch::Request.new(env) + @_response = ActionDispatch::Response.new + @_response.request = request + super + end + + def params + @_params ||= @_request.parameters + end + + # :api: private + def to_rack + @_response.prepare! + @_response.to_a + end + + def response_body=(body) + response.body = body if response + super + end + end +end -- cgit v1.2.3 From 16c01224cbe503ab1f4d0f02955b16662be00116 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Thu, 6 Aug 2009 20:05:14 -0300 Subject: ActionController::Metal#to_rack converted to #to_a to match normal rack convention --- actionpack/lib/action_controller/metal/rack_convenience.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib/action_controller/metal/rack_convenience.rb') diff --git a/actionpack/lib/action_controller/metal/rack_convenience.rb b/actionpack/lib/action_controller/metal/rack_convenience.rb index 805157b0e3..5fac445dab 100644 --- a/actionpack/lib/action_controller/metal/rack_convenience.rb +++ b/actionpack/lib/action_controller/metal/rack_convenience.rb @@ -20,7 +20,7 @@ module ActionController end # :api: private - def to_rack + def to_a @_response.prepare! @_response.to_a end -- cgit v1.2.3