aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/form_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view/helpers/form_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index ef1c51d4e7..fe060921ff 100644
--- a/actionpack/lib/action_view/helpers/form_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_helper.rb
@@ -842,7 +842,12 @@ module ActionView
checked = self.class.check_box_checked?(value(object), checked_value)
end
options["checked"] = "checked" if checked
- add_default_name_and_id(options)
+ if options["multiple"]
+ add_default_name_and_id_for_value(checked_value, options)
+ options.delete("multiple")
+ else
+ add_default_name_and_id(options)
+ end
hidden = tag("input", "name" => options["name"], "type" => "hidden", "value" => options['disabled'] && checked ? checked_value : unchecked_value)
checkbox = tag("input", options)
(hidden + checkbox).html_safe!