aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb10
-rw-r--r--actionpack/lib/action_view/helpers/prototype_helper.rb2
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