From 6b7e51df511ccda550856435029ac7dc232b9d7a Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 10 Dec 2005 00:41:32 +0000 Subject: Added form_remote_for [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3269 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/helpers/prototype_helper.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_view/helpers') diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb index 94de4613ce..647b05779a 100644 --- a/actionpack/lib/action_view/helpers/prototype_helper.rb +++ b/actionpack/lib/action_view/helpers/prototype_helper.rb @@ -170,6 +170,13 @@ module ActionView tag("form", options[:html], true) end + # Works like form_remote_tag, but uses form_for semantics. + def form_remote_for(object_name, object, options = {}, &proc) + concat(form_remote_tag(options), proc.binding) + fields_for(object_name, object, &proc) + concat(end_form_tag, proc.binding) + end + # Returns a button input tag that will submit form using XMLHttpRequest # in the background instead of regular reloading POST arrangement. # options argument is the same as in form_remote_tag. @@ -235,7 +242,6 @@ module ActionView # # See also JavaScriptGenerator and update_page. def update_element_function(element_id, options = {}, &block) - content = escape_javascript(options[:content] || '') content = escape_javascript(capture(&block)) if block -- cgit v1.2.3