From a10ed70999935cf86bd9a170ce3d4748631968ca Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Mon, 13 Feb 2012 22:48:47 -0200 Subject: Allow collection helpers with block to access current object in the collection This gives a lot more flexibility to the user, for instance to generate a collection of check boxes and labels, allowing to add custom classes or data-* attributes to the label/check_box using another object attribute. This basically mimics options_for_select functionality that accepts a third option for each item to generate html attributes for each option. --- actionpack/lib/action_view/helpers/tags/collection_check_boxes.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_view/helpers/tags/collection_check_boxes.rb') 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 5f1e9ec026..e23f5113fb 100644 --- a/actionpack/lib/action_view/helpers/tags/collection_check_boxes.rb +++ b/actionpack/lib/action_view/helpers/tags/collection_check_boxes.rb @@ -14,9 +14,9 @@ module ActionView end def render - rendered_collection = render_collection do |value, text, default_html_options| + rendered_collection = render_collection do |item, value, text, default_html_options| default_html_options[:multiple] = true - builder = instantiate_builder(CheckBoxBuilder, value, text, default_html_options) + builder = instantiate_builder(CheckBoxBuilder, item, value, text, default_html_options) if block_given? yield builder -- cgit v1.2.3