From c2ad51a2d037b709f4475cf115d89432ec56caac Mon Sep 17 00:00:00 2001 From: Vasiliy Ermolovich Date: Mon, 8 Jun 2015 23:55:10 +0300 Subject: Collection check boxes propagates input's id to the label's for attribute. --- actionview/lib/action_view/helpers/tags/collection_helpers.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'actionview/lib/action_view') diff --git a/actionview/lib/action_view/helpers/tags/collection_helpers.rb b/actionview/lib/action_view/helpers/tags/collection_helpers.rb index fea4c8d4ec..b87b4281d6 100644 --- a/actionview/lib/action_view/helpers/tags/collection_helpers.rb +++ b/actionview/lib/action_view/helpers/tags/collection_helpers.rb @@ -19,6 +19,8 @@ module ActionView def label(label_html_options={}, &block) html_options = @input_html_options.slice(:index, :namespace).merge(label_html_options) + html_options[:for] ||= @input_html_options[:id] if @input_html_options[:id] + @template_object.label(@object_name, @sanitized_attribute_name, @text, html_options, &block) end end -- cgit v1.2.3