diff options
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/abstract_controller/rendering.rb | 14 | ||||
-rw-r--r-- | actionpack/lib/action_controller/metal.rb | 8 |
2 files changed, 8 insertions, 14 deletions
diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb index eec7e520fa..402ad7c8d7 100644 --- a/actionpack/lib/abstract_controller/rendering.rb +++ b/actionpack/lib/abstract_controller/rendering.rb @@ -76,7 +76,7 @@ module AbstractController # :api: plugin def render_to_string(options={}) _normalize_options(options) - AbstractController::Rendering.body_to_s(render_to_body(options)) + render_to_body(options) end # Find and renders a template based on the options given. @@ -90,18 +90,6 @@ module AbstractController controller_path end - # Return a string representation of a Rack-compatible response body. - def self.body_to_s(body) - if body.respond_to?(:to_str) - body - else - strings = [] - body.each { |part| strings << part.to_s } - body.close if body.respond_to?(:close) - strings.join - end - end - private # This method should return a hash with assigns. diff --git a/actionpack/lib/action_controller/metal.rb b/actionpack/lib/action_controller/metal.rb index a148c19a31..30aa34d956 100644 --- a/actionpack/lib/action_controller/metal.rb +++ b/actionpack/lib/action_controller/metal.rb @@ -38,7 +38,8 @@ module ActionController delegate :session, :to => "@_request" def initialize(*) - @_headers = {} + @_headers = {"Content-Type" => "text/html"} + @_status = 200 super end @@ -70,6 +71,11 @@ module ActionController @_status = Rack::Utils.status_code(status) end + def response_body=(val) + body = val.respond_to?(:each) ? val : [val] + super body + end + # :api: private def dispatch(name, request) @_request = request |