aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormaciej-ka <maciej.kasprzyk.it@gmail.com>2017-12-07 01:43:43 +0100
committermaciej-ka <maciej.kasprzyk.it@gmail.com>2017-12-07 01:43:43 +0100
commit46a4ac8a3656fba62d9fbeee79cf8f7306d6a8aa (patch)
treea766bf29081d31b216e583a590aecd8a7b164d97
parent19d2fab6ff11222757a06bc1bd24f3c5df2d10d3 (diff)
downloadrails-46a4ac8a3656fba62d9fbeee79cf8f7306d6a8aa.tar.gz
rails-46a4ac8a3656fba62d9fbeee79cf8f7306d6a8aa.tar.bz2
rails-46a4ac8a3656fba62d9fbeee79cf8f7306d6a8aa.zip
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 %>