From f404317210b4079f2dae8cd3cfb82eb9d3fd4529 Mon Sep 17 00:00:00 2001 From: Jeffrey Hardy Date: Thu, 15 Oct 2009 00:12:07 -0400 Subject: [PATCH] Remove impossible case and lying comment, don't hide method/token tag generation --- .../lib/action_view/helpers/form_tag_helper.rb | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index eaba603..e156379 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -444,16 +444,17 @@ module ActionView end def extra_tags_for_form(html_options) - case method = html_options.delete("method").to_s - when /^get$/i # must be case-insentive, but can't use downcase as might be nil + case method = html_options.delete("method").to_s.downcase + when "get" html_options["method"] = "get" '' - when /^post$/i, "", nil + when "post", "" html_options["method"] = "post" protect_against_forgery? ? content_tag(:div, token_tag, :style => 'margin:0;padding:0;display:inline') : '' else html_options["method"] = "post" - content_tag(:div, tag(:input, :type => "hidden", :name => "_method", :value => method) + token_tag, :style => 'margin:0;padding:0;display:inline') + method_tag = tag(:input, :type => "hidden", :name => "_method", :value => method) + content_tag(:div, method_tag + token_tag, :style => 'margin:0;padding:0;display:inline') end end @@ -470,10 +471,10 @@ module ActionView end def token_tag - unless protect_against_forgery? - '' - else + if protect_against_forgery? tag(:input, :type => "hidden", :name => request_forgery_protection_token.to_s, :value => form_authenticity_token) + else + '' end end -- 1.6.3.3