def checkbox_group(field, choices, options={})
title = options.delete(:title) || label_for_field(@object, field)
note = options.delete(:note)
fieldname = "#{@object_name}[#{field.singularize}_ids][]"
with_format(title,
choices.map { |item|
res = []
res << '<span'
res << "class=\"#{options[:class]}\"" if options[:class]
res << '><input type="checkbox"'
if @object.send(field.to_s.pluralize).include? item
res << 'checked="checked"'
end
res << "id=\"#{fieldname}\" name=\"#{fieldname}\" "
res << "value=\"#{item.id}\"> #{_ item.name}</span><br/>"
res.join(' ') }.to_s,
note)
end