diff options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 14 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/record_tag_helper.rb | 6 |
2 files changed, 11 insertions, 9 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index ed83658140..6c3d2cf1b8 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -519,16 +519,18 @@ module ActionView # Delete: <%= project_fields.check_box :_destroy %> # <% end %> # <% end %> - def fields_for(record_or_name_or_array, *args, &block) + def fields_for(record, record_object = nil, options = nil, &block) raise ArgumentError, "Missing block" unless block_given? - options = args.extract_options! - case record_or_name_or_array + options, record_object = record_object, nil if record_object.is_a?(Hash) + options ||= {} + + case record when String, Symbol - object_name = record_or_name_or_array - object = args.first + object = record_object + object_name = record else - object = record_or_name_or_array + object = record object_name = ActiveModel::Naming.singular(object) end diff --git a/actionpack/lib/action_view/helpers/record_tag_helper.rb b/actionpack/lib/action_view/helpers/record_tag_helper.rb index e4a9210cde..4d300a1469 100644 --- a/actionpack/lib/action_view/helpers/record_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/record_tag_helper.rb @@ -52,9 +52,9 @@ module ActionView # # <li id="person_123" class="person bar">... # - def content_tag_for(tag_name, record, *args, &block) - prefix = args.first.is_a?(Hash) ? nil : args.shift - options = args.extract_options! + def content_tag_for(tag_name, record, prefix = nil, options = nil, &block) + options, prefix = prefix, nil if prefix.is_a?(Hash) + options ||= {} options.merge!({ :class => "#{dom_class(record, prefix)} #{options[:class]}".strip, :id => dom_id(record, prefix) }) content_tag(tag_name, options, &block) end |