From 517e2fd89bc9f4aafdfe412401c7a33a1c8e343e Mon Sep 17 00:00:00 2001 From: Jan Dudek Date: Sat, 14 Feb 2009 20:16:16 +0100 Subject: [PATCH] Make link_to :method => ... append form to the end of the document Prior to this change form was appended as a sibling of link element, which may cause trouble if you have link_to :method => .. inside a form. --- actionpack/lib/action_view/helpers/url_helper.rb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb index 36e0a78..e1af8f1 100644 --- a/actionpack/lib/action_view/helpers/url_helper.rb +++ b/actionpack/lib/action_view/helpers/url_helper.rb @@ -592,7 +592,7 @@ module ActionView action = (href && url.size > 0) ? "'#{url}'" : 'this.href' submit_function = "var f = document.createElement('form'); f.style.display = 'none'; " + - "this.parentNode.appendChild(f); f.method = 'POST'; f.action = #{action};" + "document.body.appendChild(f); f.method = 'POST'; f.action = #{action};" unless method == :post submit_function << "var m = document.createElement('input'); m.setAttribute('type', 'hidden'); " -- 1.5.6.3