diff options
author | Eileen M. Uchitelle <eileencodes@users.noreply.github.com> | 2017-10-04 08:43:21 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-04 08:43:21 -0400 |
commit | df2814671cce80fd0d8f290e5a70bf518880d6fa (patch) | |
tree | 9890685abbb82399e6b53ef0b86568e30a0f2fce /guides/source | |
parent | f1e89628fe3d18427e3b6644b1e7f3ef965ecd5b (diff) | |
parent | 521266f913083c3029567ffe647e08e39af7f18a (diff) | |
download | rails-df2814671cce80fd0d8f290e5a70bf518880d6fa.tar.gz rails-df2814671cce80fd0d8f290e5a70bf518880d6fa.tar.bz2 rails-df2814671cce80fd0d8f290e5a70bf518880d6fa.zip |
Merge pull request #30734 from oreoshake/patch-1
Encourage html-safe API in layouts/rendering guide
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/layouts_and_rendering.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/guides/source/layouts_and_rendering.md b/guides/source/layouts_and_rendering.md index fe2477f2ae..b9b327252f 100644 --- a/guides/source/layouts_and_rendering.md +++ b/guides/source/layouts_and_rendering.md @@ -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 |