class SimpleForm::FormBuilder
def collection_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {}, &block)
* item_wrapper_class => the CSS class to use for item_wrapper_tag
* item_wrapper_tag => the tag to wrap each item in the collection.
is ignored if the :collection_wrapper_tag option is blank.
* collection_wrapper_class => the CSS class to use for collection_wrapper_tag. This option
* collection_wrapper_tag => the tag to wrap the entire collection.
item or an array of items.
* disabled => the value or values that should be disabled. Accepts a single
a single item or an array of items. It overrides existing associations.
* checked => the value or values that should be checked initially. Accepts
Collection check box accepts some extra options:
== Options
end
end
b.label { b.check_box + b.text }
) do |b|
:options, [[true, 'Yes'] ,[false, 'No']], :first, :last
f.collection_check_boxes(
form_for @user do |f|
label. To wrap the check box with the label, for instance:
It is also possible to give a block that should generate the check box +
end
f.collection_check_boxes :options, [[true, 'Yes'] ,[false, 'No']], :first, :last
form_for @user do |f|
== Examples
that will be evaluated for each item in the collection.
You can give a symbol or a proc to both value_method and text_method,
convert items in the collection for use as text/value in check boxes.
associated with a clickable label. Use value_method and text_method to
Creates a collection of check boxes for each item in the collection,
def collection_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {}, &block) SimpleForm::Tags::CollectionCheckBoxes.new(@object_name, method, @template, collection, value_method, text_method, objectify_options(options), @default_options.merge(html_options)).render(&block) end