aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prikhodko <prikha@gmail.com>2014-03-03 18:32:29 +0400
committerSergey Prikhodko <prikha@gmail.com>2014-03-03 18:32:29 +0400
commitca1b98a5599d25636aa07ac441579143a187bb85 (patch)
treeb0d13408e1bd3c27676c66afa6ccea2a51ffe0e4
parentd0d2497c2a00da7d96f12b3240af266428a1d579 (diff)
downloadrails-ca1b98a5599d25636aa07ac441579143a187bb85.tar.gz
rails-ca1b98a5599d25636aa07ac441579143a187bb85.tar.bz2
rails-ca1b98a5599d25636aa07ac441579143a187bb85.zip
rollback to private method
-rw-r--r--actionview/lib/action_view/helpers/form_tag_helper.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/actionview/lib/action_view/helpers/form_tag_helper.rb b/actionview/lib/action_view/helpers/form_tag_helper.rb
index 330f74882d..4113acc6e9 100644
--- a/actionview/lib/action_view/helpers/form_tag_helper.rb
+++ b/actionview/lib/action_view/helpers/form_tag_helper.rb
@@ -469,17 +469,13 @@ module ActionView
# # => <button data-disable-with="Please wait..." name="button" type="submit">Checkout</button>
#
def button_tag(content_or_options = nil, options = nil, &block)
- options ||= {}
- default_options = { 'name' => 'button', 'type' => 'submit' }
if content_or_options.is_a?(Hash)
options = content_or_options
content_or_options = nil
end
- options = options.stringify_keys
- options.reverse_merge default_options
-
+ options = button_tag_options_with_defaults(options)
content_tag :button, content_or_options || 'Button', options, &block
end
@@ -746,6 +742,14 @@ module ActionView
def sanitize_to_id(name)
name.to_s.delete(']').gsub(/[^-a-zA-Z0-9:.]/, "_")
end
+
+ def button_tag_options_with_defaults(options)
+ options = options || {}
+ options = options.stringify_keys
+
+ default_options = { 'name' => 'button', 'type' => 'submit' }
+ options.reverse_merge default_options
+ end
end
end
end