Permalink
Browse files

Include block in a argument shift

  • Loading branch information...
1 parent f71b075 commit bcc30d8f2fc50ff096fd045cf9e507ce547a739d @sanemat sanemat committed Jul 7, 2013
Showing with 2 additions and 6 deletions.
  1. +2 −6 actionview/lib/action_view/helpers/url_helper.rb
@@ -172,19 +172,15 @@ def _back_url # :nodoc:
# 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)
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

0 comments on commit bcc30d8

Please sign in to comment.