aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/helpers/url_helper.rb
diff options
context:
space:
mode:
authorsanemat <o.gata.ken@gmail.com>2013-07-07 23:14:34 +0900
committersanemat <o.gata.ken@gmail.com>2013-07-07 23:21:47 +0900
commitf71b075d6c29447d08193007936f6376779d7bff (patch)
treeb5d03a97f62a568447e32a064614587d2d685f65 /actionview/lib/action_view/helpers/url_helper.rb
parent239126385f75d84e8d62b65879837db0f5ae2f7a (diff)
downloadrails-f71b075d6c29447d08193007936f6376779d7bff.tar.gz
rails-f71b075d6c29447d08193007936f6376779d7bff.tar.bz2
rails-f71b075d6c29447d08193007936f6376779d7bff.zip
Fix link_to with block and url_hash
Use link_to with block and url_hash, expect block as name. But ignore block and use url_hash as name. 3-2-stable passes this test. 4-0-stable and master fail this.
Diffstat (limited to 'actionview/lib/action_view/helpers/url_helper.rb')
-rw-r--r--actionview/lib/action_view/helpers/url_helper.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/url_helper.rb b/actionview/lib/action_view/helpers/url_helper.rb
index 19e5941971..bfd154abec 100644
--- a/actionview/lib/action_view/helpers/url_helper.rb
+++ b/actionview/lib/action_view/helpers/url_helper.rb
@@ -180,7 +180,11 @@ module ActionView
url = url_for(options)
html_options['href'] ||= url
- content_tag(:a, name || url, html_options, &block)
+ if block_given?
+ content_tag(:a, capture(&block) || url, html_options)
+ else
+ content_tag(:a, name || url, html_options)
+ end
end
# Generates a form containing a single button that submits to the URL created