aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_view/helpers/url_helper.rb16
1 files changed, 6 insertions, 10 deletions
diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb
index a4b10bc68a..a0fa7d27e9 100644
--- a/actionpack/lib/action_view/helpers/url_helper.rb
+++ b/actionpack/lib/action_view/helpers/url_helper.rb
@@ -341,15 +341,10 @@ module ActionView
# # </div>
# # </form>"
# #
- def button_to(*args, &block)
- if block_given?
- options = args[0] || {}
- html_options = args[1] || {}
- else
- name = args[0]
- options = args[1] || {}
- html_options = args[2] || {}
- end
+ def button_to(name = nil, options = nil, html_options = nil, &block)
+ html_options, options = options, name if block_given?
+ options ||= {}
+ html_options ||= {}
html_options = html_options.stringify_keys
convert_boolean_attributes!(html_options, %w(disabled))
@@ -374,7 +369,8 @@ module ActionView
button = if block_given?
content_tag('button', html_options, &block)
else
- tag('input', html_options.merge('value' => name || url))
+ html_options['value'] = name || url
+ tag('input', html_options)
end
inner_tags = method_tag.safe_concat(button).safe_concat(request_token_tag)