Skip to content

Commit 4bfa69a

Browse files
Revise TextHelper#concat code example [ci-skip]
This simplifies the code example, and avoids putting `%>` _inside_ an ERB tag, which confuses the syntax highlighter.
1 parent ca5c27e commit 4bfa69a

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

actionview/lib/action_view/helpers/text_helper.rb

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,20 @@ module TextHelper
4646
# output text within a non-output code block (i.e., <tt><% %></tt>), you
4747
# can use the +concat+ method.
4848
#
49+
# <% concat "hello" %> is equivalent to <%= "hello" %>
50+
#
4951
# <%
50-
# concat "hello"
51-
# # is the equivalent of <%= "hello" %>
52-
#
53-
# if logged_in
54-
# concat "Logged in!"
55-
# else
56-
# concat link_to('login', action: :login)
57-
# end
58-
# # will either display "Logged in!" or a login link
52+
# unless signed_in?
53+
# concat link_to("Sign In", action: :sign_in)
54+
# end
5955
# %>
56+
#
57+
# is equivalent to
58+
#
59+
# <% unless signed_in? %>
60+
# <%= link_to "Sign In", action: :sign_in %>
61+
# <% end %>
62+
#
6063
def concat(string)
6164
output_buffer << string
6265
end

0 commit comments

Comments
 (0)