1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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.
This commit is contained in:
akihiro17 2015-08-27 14:05:47 +09:00
parent cbe7899f9d
commit 2de60a926b
2 changed files with 2 additions and 3 deletions

View file

@ -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

View file

@ -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!"