aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/form_helper.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2010-01-30 14:39:41 -0600
committerJoshua Peek <josh@joshpeek.com>2010-01-30 14:39:59 -0600
commit4f7a85d2c66f100f83e2fe264e1f03bf079f13dc (patch)
treea9304cf3c3006b472da7e75cf339d6641160e728 /actionpack/lib/action_view/helpers/form_helper.rb
parentac20f2cea15844b5cc06bdfefbb410fc55ba5caf (diff)
downloadrails-4f7a85d2c66f100f83e2fe264e1f03bf079f13dc.tar.gz
rails-4f7a85d2c66f100f83e2fe264e1f03bf079f13dc.tar.bz2
rails-4f7a85d2c66f100f83e2fe264e1f03bf079f13dc.zip
Revert "Merge branch 'rails/master' into ujs"
This reverts commit 3aa1ea1ae4baa4a03d03644e798eeb98a4745785, reversing changes made to 2c12a71378d2146c822acb389b00b866f6420ff5. Conflicts: actionpack/lib/action_view/helpers/javascript_helper.rb actionpack/lib/action_view/helpers/url_helper.rb actionpack/test/template/url_helper_test.rb
Diffstat (limited to 'actionpack/lib/action_view/helpers/form_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb36
1 files changed, 16 insertions, 20 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index 1615f135b4..20e9916d62 100644
--- a/actionpack/lib/action_view/helpers/form_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_helper.rb
@@ -262,8 +262,23 @@ module ActionView
# FormTagHelper#form_tag.
def form_for(record_or_name_or_array, *args, &proc)
raise ArgumentError, "Missing block" unless block_given?
+
options = args.extract_options!
- object_name = extract_object_name_for_form!(args, options, record_or_name_or_array)
+
+ case record_or_name_or_array
+ when String, Symbol
+ object_name = record_or_name_or_array
+ when Array
+ object = record_or_name_or_array.last
+ object_name = ActionController::RecordIdentifier.singular_class_name(object)
+ apply_form_for_options!(record_or_name_or_array, options)
+ args.unshift object
+ else
+ object = record_or_name_or_array
+ object_name = ActionController::RecordIdentifier.singular_class_name(object)
+ apply_form_for_options!([object], options)
+ args.unshift object
+ end
concat(form_tag(options.delete(:url) || {}, options.delete(:html) || {}))
fields_for(object_name, *(args << options), &proc)
@@ -727,25 +742,6 @@ module ActionView
def radio_button(object_name, method, tag_value, options = {})
InstanceTag.new(object_name, method, self, options.delete(:object)).to_radio_button_tag(tag_value, options)
end
-
- private
- def extract_object_name_for_form!(args, options, record_or_name_or_array)
- case record_or_name_or_array
- when String, Symbol
- object_name = record_or_name_or_array
- when Array
- object = record_or_name_or_array.last
- object_name = ActionController::RecordIdentifier.singular_class_name(object)
- apply_form_for_options!(record_or_name_or_array, options)
- args.unshift object
- else
- object = record_or_name_or_array
- object_name = ActionController::RecordIdentifier.singular_class_name(object)
- apply_form_for_options!([object], options)
- args.unshift object
- end
- object_name
- end
end
module InstanceTagMethods #:nodoc: