class ActionView::Helpers::Tags::CollectionCheckBoxes
:nodoc:
:nodoc:
def hidden_field
def hidden_field hidden_name = @html_options[:name] hidden_name ||= if @options.has_key?(:index) "#{tag_name_with_index(@options[:index])}[]" else "#{tag_name}[]" end @template_object.hidden_field_tag(hidden_name, "", id: nil) end
def render(&block)
def render(&block) rendered_collection = render_collection do |item, value, text, default_html_options| default_html_options[:multiple] = true builder = instantiate_builder(CheckBoxBuilder, item, value, text, default_html_options) if block_given? @template_object.capture(builder, &block) else render_component(builder) end end # Append a hidden field to make sure something will be sent back to the # server if all check boxes are unchecked. rendered_collection + hidden_field end
def render_component(builder)
def render_component(builder) builder.check_box + builder.label end