rails/rails — pull request #14062 by sikachu (2014-02-14 18:28:19+00:00)
Title: Introduce `:plain`, `:html`, and `:body` render options.

This is a continuation from #12374, with slight modification since the discussion went a bit off-topic.

-----

Per discussion, `render :text` misdirect people to think that it would render content with `text/plain` MIME type. However, `render :text` actually sets the response body directly, and inherits the default response MIME type, which is `text/html`.

In order to reduce confusion, we're introducing 3 more render format to `render`:

```ruby
render html: 'HTML String'.html_safe # render with `text/html` MIME type.

render plain: 'plain text' # render with `text/plain` MIME type.

render body: 'raw body' # render raw content, does not set content type.
```

We want to phrase out the usage of `render :text`, to reduce the confusion in the future. There's currently no plan for deprecating `render :text`.

Fixes #12374