lib/informant.rb
def habtm_check_boxes(method, choices, options = {})
      choices.map!{ |i| i.is_a?(Array) ? i : [i] }
      base_id   = "#{object_name}_#{method}"
      base_name = "#{object_name}[#{method}]"

      @template.hidden_field_tag(
        "#{base_name}[]", "", :id => "#{base_id}_empty") +
      build_shell(method, options, "habtm_check_boxes_field") do
        choices.map do |c|
          field_id = "#{base_id}_#{c[1].to_s.downcase}"
          habtm_single_check_box_template(
            :name => "#{base_name}[]",
            :id => field_id,
            :value => c[1],
            :checked => @object.send(method).include?(c[1]),
            :label => @template.label_tag(field_id, c[0])
          )
        end
      end
    end
def habtm_check_boxes(method, choices, options = {})
      choices.map!{ |i| i.is_a?(Array) ? i : [i] }
      base_id   = "#{object_name}_#{method}"
      base_name = "#{object_name}[#{method}]"

      @template.hidden_field_tag(
        "#{base_name}[]", "", :id => "#{base_id}_empty") +
      build_shell(method, options, "habtm_check_boxes_field") do
        choices.map do |c|
          field_id = "#{base_id}_#{c[1].to_s.downcase}"
          habtm_single_check_box_template(
            :name => "#{base_name}[]",
            :id => field_id,
            :value => c[1],
            :checked => @object.send(method).include?(c[1]),
            :label => @template.label_tag(field_id, c[0])
          )
        end
      end
    end
Render a set of check boxes for selecting HABTM-associated objects.
 Takes a method name (eg, category_ids), an array of
 choices (just like a +select+ field), and an Informant options hash.
 In the default template the check boxes are enclosed in a <div> with
 CSS class <tt>habtm_check_boxes</tt> which can be styled thusly to
 achieve a scrolling list:

   .habtm_check_boxes {
     overflow: auto;
     height: 150px;
   }

 A hidden field is included which eliminates the need to handle the
 no-boxes-checked case in the controller, for example:

   <input type="hidden" name="article[categories][]" value="" />

 This ensures that un-checking all boxes will work as expected.
 Unfortunately the check_box template is not applied to each check box
 (because the standard method of querying the @object for the field's
 value does not work--ie, there is no "categories[]" method).