diff options
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/tags/base.rb | 8 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/tags/collection_check_boxes.rb | 2 |
2 files changed, 4 insertions, 6 deletions
diff --git a/actionpack/lib/action_view/helpers/tags/base.rb b/actionpack/lib/action_view/helpers/tags/base.rb index 192f5eebaa..3d597079c4 100644 --- a/actionpack/lib/action_view/helpers/tags/base.rb +++ b/actionpack/lib/action_view/helpers/tags/base.rb @@ -80,9 +80,11 @@ module ActionView options["name"] ||= options.fetch("name"){ tag_name_with_index(@auto_index) } options["id"] = options.fetch("id"){ tag_id_with_index(@auto_index) } else - options["name"] ||= options.fetch("name"){ options['multiple'] ? tag_name_multiple : tag_name } + options["name"] ||= options.fetch("name"){ tag_name } options["id"] = options.fetch("id"){ tag_id } end + + options["name"] += "[]" if options["multiple"] options["id"] = [options.delete('namespace'), options["id"]].compact.join("_").presence end @@ -90,10 +92,6 @@ module ActionView "#{@object_name}[#{sanitized_method_name}]" end - def tag_name_multiple - "#{tag_name}[]" - end - def tag_name_with_index(index) "#{@object_name}[#{index}][#{sanitized_method_name}]" end diff --git a/actionpack/lib/action_view/helpers/tags/collection_check_boxes.rb b/actionpack/lib/action_view/helpers/tags/collection_check_boxes.rb index e23f5113fb..45f0bc3d7b 100644 --- a/actionpack/lib/action_view/helpers/tags/collection_check_boxes.rb +++ b/actionpack/lib/action_view/helpers/tags/collection_check_boxes.rb @@ -27,7 +27,7 @@ module ActionView # Append a hidden field to make sure something will be sent back to the # server if all check boxes are unchecked. - hidden = @template_object.hidden_field_tag(tag_name_multiple, "", :id => nil) + hidden = @template_object.hidden_field_tag("#{tag_name}[]", "", :id => nil) rendered_collection + hidden end |