Skip to content

Commit e34a0ee

Browse files
authored
Merge pull request rails#51186 from Earlopain/encourage-html-safe-methods-for-safe-join
Docs: Encourage html safe methods for safe join [ci skip]
2 parents 4a95c64 + 295e707 commit e34a0ee

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

actionview/lib/action_view/helpers/output_safety_helper.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ def raw(stringish)
2424
# the supplied separator, are HTML escaped unless they are HTML
2525
# safe, and the returned string is marked as HTML safe.
2626
#
27-
# safe_join([raw("<p>foo</p>"), "<p>bar</p>"], "<br />")
28-
# # => "<p>foo</p>&lt;br /&gt;&lt;p&gt;bar&lt;/p&gt;"
27+
# safe_join([tag.p("foo"), "<p>bar</p>"], "<br>")
28+
# # => "<p>foo</p>&lt;br&gt;&lt;p&gt;bar&lt;/p&gt;"
2929
#
30-
# safe_join([raw("<p>foo</p>"), raw("<p>bar</p>")], raw("<br />"))
31-
# # => "<p>foo</p><br /><p>bar</p>"
30+
# safe_join([tag.p("foo"), tag.p("bar")], tag.br)
31+
# # => "<p>foo</p><br><p>bar</p>"
3232
#
3333
def safe_join(array, sep = $,)
3434
sep = ERB::Util.unwrapped_html_escape(sep)

0 commit comments

Comments
 (0)