def collection_check_boxes(attribute, collection, value_method, text_method, options={}, html_options={})
rendered_collection = render_collection(
collection, value_method, text_method, options, html_options
) do |item, value, text, default_html_options|
default_html_options[:multiple] = true
builder = instantiate_builder(CheckBoxBuilder, attribute, item, value, text, default_html_options)
if block_given?
yield builder
else
builder.check_box + builder.label(:class => "collection_check_boxes")
end
end
hidden = template.hidden_field_tag("#{object_name}[#{attribute}][]", "", :id => nil)
wrap_rendered_collection(rendered_collection + hidden, options)
end