aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio B <claudiob@users.noreply.github.com>2017-12-08 20:05:00 -0800
committerGitHub <noreply@github.com>2017-12-08 20:05:00 -0800
commita521e03c9cd227d2677472453a02f8cb99f3ca08 (patch)
treebc3ba286a2c690a90aab31729ba3e632b71d0650
parentbc2e08034d4ee5e38536928ae0cb90210d27ddcf (diff)
parent46a4ac8a3656fba62d9fbeee79cf8f7306d6a8aa (diff)
downloadrails-a521e03c9cd227d2677472453a02f8cb99f3ca08.tar.gz
rails-a521e03c9cd227d2677472453a02f8cb99f3ca08.tar.bz2
rails-a521e03c9cd227d2677472453a02f8cb99f3ca08.zip
Merge pull request #31354 from maciej-ka/docs-link_to-nil-name-example
docs: add example for a nil name in link_to
-rw-r--r--actionview/lib/action_view/helpers/url_helper.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/actionview/lib/action_view/helpers/url_helper.rb b/actionview/lib/action_view/helpers/url_helper.rb
index 02335c72ec..889562c478 100644
--- a/actionview/lib/action_view/helpers/url_helper.rb
+++ b/actionview/lib/action_view/helpers/url_helper.rb
@@ -139,6 +139,11 @@ module ActionView
# link_to "Profiles", controller: "profiles"
# # => <a href="/profiles">Profiles</a>
#
+ # When name is +nil+ the href is presented instead
+ #
+ # link_to nil, "http://example.com"
+ # # => <a href="http://www.example.com">http://www.example.com</a>
+ #
# You can use a block as well if your link target is hard to fit into the name parameter. ERB example:
#
# <%= link_to(@profile) do %>