aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/helpers/url_helper.rb
diff options
context:
space:
mode:
authorsanemat <o.gata.ken@gmail.com>2013-07-08 00:35:14 +0900
committersanemat <o.gata.ken@gmail.com>2013-07-08 00:35:14 +0900
commitbcc30d8f2fc50ff096fd045cf9e507ce547a739d (patch)
tree168433e75563ed56b8d0981e48b29131f3afeb5c /actionview/lib/action_view/helpers/url_helper.rb
parentf71b075d6c29447d08193007936f6376779d7bff (diff)
downloadrails-bcc30d8f2fc50ff096fd045cf9e507ce547a739d.tar.gz
rails-bcc30d8f2fc50ff096fd045cf9e507ce547a739d.tar.bz2
rails-bcc30d8f2fc50ff096fd045cf9e507ce547a739d.zip
Include block in a argument shift
Diffstat (limited to 'actionview/lib/action_view/helpers/url_helper.rb')
-rw-r--r--actionview/lib/action_view/helpers/url_helper.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/actionview/lib/action_view/helpers/url_helper.rb b/actionview/lib/action_view/helpers/url_helper.rb
index bfd154abec..daa9a393b3 100644
--- a/actionview/lib/action_view/helpers/url_helper.rb
+++ b/actionview/lib/action_view/helpers/url_helper.rb
@@ -172,7 +172,7 @@ module ActionView
# link_to "Visit Other Site", "http://www.rubyonrails.org/", data: { confirm: "Are you sure?" }
# # => <a href="http://www.rubyonrails.org/" data-confirm="Are you sure?">Visit Other Site</a>
def link_to(name = nil, options = nil, html_options = nil, &block)
- html_options, options = options, name if block_given?
+ html_options, options, name = options, name, block if block_given?
options ||= {}
html_options = convert_options_to_data_attributes(options, html_options)
@@ -180,11 +180,7 @@ module ActionView
url = url_for(options)
html_options['href'] ||= url
- if block_given?
- content_tag(:a, capture(&block) || url, html_options)
- else
- content_tag(:a, name || url, html_options)
- end
+ content_tag(:a, name || url, html_options, &block)
end
# Generates a form containing a single button that submits to the URL created