提交 df281467 编写于 作者: E Eileen M. Uchitelle 提交者: GitHub

Merge pull request #30734 from oreoshake/patch-1

Encourage html-safe API in layouts/rendering guide
......@@ -232,14 +232,14 @@ You can send an HTML string back to the browser by using the `:html` option to
`render`:
```ruby
render html: "<strong>Not Found</strong>".html_safe
render html: helpers.tag.strong('Not Found')
```
TIP: This is useful when you're rendering a small snippet of HTML code.
However, you might want to consider moving it to a template file if the markup
is complex.
NOTE: When using `html:` option, HTML entities will be escaped if the string is not marked as HTML safe by using `html_safe` method.
NOTE: When using `html:` option, HTML entities will be escaped if the string is not composed with `html_safe`-aware APIs.
#### Rendering JSON
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册