diff options
author | akihiro17 <coolwizard11@gmail.com> | 2015-08-27 14:05:47 +0900 |
---|---|---|
committer | akihiro17 <coolwizard11@gmail.com> | 2015-08-29 01:02:43 +0900 |
commit | 2de60a926b541d837d7a927bb2efc8135679ac40 (patch) | |
tree | cb3217fc334341f094f207662a9d93d38be27270 | |
parent | cbe7899f9d5fece4749f75828fd120d67056f356 (diff) | |
download | rails-2de60a926b541d837d7a927bb2efc8135679ac40.tar.gz rails-2de60a926b541d837d7a927bb2efc8135679ac40.tar.bz2 rails-2de60a926b541d837d7a927bb2efc8135679ac40.zip |
Set the content-type to `text/html` if the options[:html] is true
In this commit, we set the content-type to `text/html` in AbstractController if the `options[:html]` is true so that we don't include ActionView::Rendering into ActionController::Metal to set it properly.
I removed the if `options[:plain]` statement because `AbstractController#rendered_format` returns `Mime::TEXT` by default.
-rw-r--r-- | actionpack/lib/abstract_controller/rendering.rb | 4 | ||||
-rw-r--r-- | actionpack/test/controller/new_base/render_html_test.rb | 1 |
2 files changed, 2 insertions, 3 deletions
diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb index 2bb7c2139e..6db0941b52 100644 --- a/actionpack/lib/abstract_controller/rendering.rb +++ b/actionpack/lib/abstract_controller/rendering.rb @@ -23,8 +23,8 @@ module AbstractController def render(*args, &block) options = _normalize_render(*args, &block) self.response_body = render_to_body(options) - if options[:plain] - _set_content_type Mime::TEXT.to_s + if options[:html] + _set_content_type Mime::HTML.to_s else _set_content_type _get_content_type(rendered_format) end diff --git a/actionpack/test/controller/new_base/render_html_test.rb b/actionpack/test/controller/new_base/render_html_test.rb index 49c1b67d04..e9ea57e329 100644 --- a/actionpack/test/controller/new_base/render_html_test.rb +++ b/actionpack/test/controller/new_base/render_html_test.rb @@ -4,7 +4,6 @@ module RenderHtml class MinimalController < ActionController::Metal include AbstractController::Rendering include ActionController::Rendering - include ActionView::Rendering def index render html: "Hello World!" |