Added form_remote_for [DHH]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3269 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson 2005-12-10 00:41:32 +00:00
parent cebb8ff04b
commit 6b7e51df51

@ -170,6 +170,13 @@ def form_remote_tag(options = {})
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.
# <tt>options</tt> argument is the same as in <tt>form_remote_tag</tt>.
@ -235,7 +242,6 @@ def submit_to_remote(name, value, options = {})
#
# 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