def collection_checks(method, collection, value_method, text_method, options = {}, &block)
check_boxes = []
collection.each do |choice|
text = choice.send(text_method)
value = choice.send(value_method)
check = MetaSearch::Check.new
check.box = @template.check_box_tag(
"#{@object_name}[#{method}][]",
value,
[@object.send(method)].flatten.include?(value),
options.merge(:id => [@object_name, method.to_s, value.to_s.underscore].join('_'))
)
check.label = @template.label_tag([@object_name, method.to_s, value.to_s.underscore].join('_'),
text)
if block_given?
yield check
else
check_boxes << check
end
end
check_boxes unless block_given?
end