aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorErik St. Martin <alakriti@gmail.com>2010-01-31 15:40:40 -0500
committerJoshua Peek <josh@joshpeek.com>2010-01-31 14:43:07 -0600
commite1618b9ac397d1963e788f441fc4965cd3f9d4cf (patch)
treec359978a43277eafe9298d37e4b6e4951c09a992 /actionpack/lib
parenta9e89e82b67f721fe68ca58a2d371b666cdb7441 (diff)
downloadrails-e1618b9ac397d1963e788f441fc4965cd3f9d4cf.tar.gz
rails-e1618b9ac397d1963e788f441fc4965cd3f9d4cf.tar.bz2
rails-e1618b9ac397d1963e788f441fc4965cd3f9d4cf.zip
data-remote needs to be on the form and not the submit when using button_to :remote=>true
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_view/helpers/url_helper.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb
index bd179ef0b3..e56bfc7bfd 100644
--- a/actionpack/lib/action_view/helpers/url_helper.rb
+++ b/actionpack/lib/action_view/helpers/url_helper.rb
@@ -286,6 +286,8 @@ module ActionView
form_method = method.to_s == 'get' ? 'get' : 'post'
+ remote = html_options.delete('remote')
+
request_token_tag = ''
if form_method == 'post' && protect_against_forgery?
request_token_tag = tag(:input, :type => "hidden", :name => request_forgery_protection_token.to_s, :value => form_authenticity_token)
@@ -298,7 +300,7 @@ module ActionView
html_options.merge!("type" => "submit", "value" => name)
- ("<form method=\"#{form_method}\" action=\"#{escape_once url}\" class=\"button-to\"><div>" +
+ ("<form method=\"#{form_method}\" action=\"#{escape_once url}\" #{"data-remote=\"true\"" if remote} class=\"button-to\"><div>" +
method_tag + tag("input", html_options) + request_token_tag + "</div></form>").html_safe!
end