diff options
author | Nicholas Seckar <nseckar@gmail.com> | 2006-02-06 05:06:36 +0000 |
---|---|---|
committer | Nicholas Seckar <nseckar@gmail.com> | 2006-02-06 05:06:36 +0000 |
commit | 7139e2a0e1c24788758ccd6131ba86243de84bf6 (patch) | |
tree | d849489ad5728d24e63debbae8f88d68f2e8e1cb /actionpack/lib/action_view | |
parent | 796295dba6839bf417c19a2f41fe2a32d968367a (diff) | |
download | rails-7139e2a0e1c24788758ccd6131ba86243de84bf6.tar.gz rails-7139e2a0e1c24788758ccd6131ba86243de84bf6.tar.bz2 rails-7139e2a0e1c24788758ccd6131ba86243de84bf6.zip |
Fix remote_form_for creates a non-ajax form. Closes #3741.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3545 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 10 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/prototype_helper.rb | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 75c09dfe87..9473b59563 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -117,13 +117,17 @@ module ActionView def form_for(object_name, object, options = {}, &proc) raise ArgumentError, "form_for requires a block!" unless proc - url_options = options.delete :url + url_options = options.delete(:url) || {} form_tag_selector = options.delete(:form_tag_selector) || :form_tag - form_options = {} + form_options = {} [:method, :multipart].each { |key| form_options[key] = options.delete(key) if options.key? key } fields_for(object_name, object, options.merge(:proc => proc)) do |builder| - concat send(form_tag_selector, url_options, form_options), proc.binding + if form_tag_selector == :form_remote_tag + concat send(form_tag_selector, form_options.merge(:url => url_options)), proc.binding + else + concat send(form_tag_selector, url_options, form_options), proc.binding + end builder.build_form(url_options, form_options) { proc.call builder } concat end_form_tag, proc.binding end diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb index 2cd7550c65..523adb3288 100644 --- a/actionpack/lib/action_view/helpers/prototype_helper.rb +++ b/actionpack/lib/action_view/helpers/prototype_helper.rb @@ -172,7 +172,7 @@ module ActionView # Works like form_remote_tag, but uses form_for semantics. def remote_form_for(object_name, object, options = {}, &proc) - form_for(object_name, object, options.merge(:form_for_select => :form_remote_tag), &proc) + form_for(object_name, object, options.merge(:form_tag_selector => :form_remote_tag), &proc) end alias_method :form_remote_for, :remote_form_for |