aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-01-18 20:53:32 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-01-19 10:38:08 -0300
commit71597f9d51887885c826a05d14680e26c86e622f (patch)
tree0d232ba0e544c6d00e2eee7bf507c13592a88f0f /actionpack/lib/action_view/helpers
parent047097950fa82cc045a514b53354a827816dc088 (diff)
downloadrails-71597f9d51887885c826a05d14680e26c86e622f.tar.gz
rails-71597f9d51887885c826a05d14680e26c86e622f.tar.bz2
rails-71597f9d51887885c826a05d14680e26c86e622f.zip
Extract method_tag
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r--actionpack/lib/action_view/helpers/form_tag_helper.rb2
-rw-r--r--actionpack/lib/action_view/helpers/url_helper.rb6
2 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb
index 41b88f9ccb..e97f602728 100644
--- a/actionpack/lib/action_view/helpers/form_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb
@@ -627,7 +627,7 @@ module ActionView
token_tag(authenticity_token)
else
html_options["method"] = "post"
- tag(:input, :type => "hidden", :name => "_method", :value => method) + token_tag(authenticity_token)
+ method_tag(method) + token_tag(authenticity_token)
end
tags = utf8_enforcer_tag << method_tag
diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb
index 96fc4fa414..56f999f2f5 100644
--- a/actionpack/lib/action_view/helpers/url_helper.rb
+++ b/actionpack/lib/action_view/helpers/url_helper.rb
@@ -327,7 +327,7 @@ module ActionView
method_tag = ''
if (method = html_options.delete('method')) && %w{put delete}.include?(method.to_s)
- method_tag = tag('input', :type => 'hidden', :name => '_method', :value => method.to_s)
+ method_tag = method_tag(method)
end
form_method = method.to_s == 'get' ? 'get' : 'post'
@@ -676,6 +676,10 @@ module ActionView
tag(:input, :type => "hidden", :name => request_forgery_protection_token.to_s, :value => token)
end
end
+
+ def method_tag(method)
+ tag('input', :type => 'hidden', :name => '_method', :value => method.to_s)
+ end
end
end
end