Extract method_tag

This commit is contained in:
Rafael Mendonça França 2012-01-18 20:53:32 -03:00
parent 047097950f
commit 71597f9d51
2 changed files with 6 additions and 2 deletions

@ -627,7 +627,7 @@ def extra_tags_for_form(html_options)
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

@ -327,7 +327,7 @@ def button_to(name, options = {}, html_options = {})
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 @@ def token_tag(token=nil)
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