instance method collection_checkboxes

Ruby on Rails 8.1.2

Since v8.0.4

Available in: v8.0.4 v8.1.2

Signature

collection_checkboxes(method, collection, value_method, text_method, options = {}, html_options = {}, &block)

Wraps ActionView::Helpers::FormOptionsHelper#collection_checkboxes for form builders:

<%= form_with model: @post do |f| %>
  <%= f.collection_checkboxes :author_ids, Author.all, :id, :name_with_initial %>
  <%= f.submit %>
<% end %>

Please refer to the documentation of the base helper for details.

Parameters

method req
collection req
value_method req
text_method req
options opt = {}
html_options opt = {}
block block
Source
# File actionview/lib/action_view/helpers/form_options_helper.rb, line 911
      def collection_checkboxes(method, collection, value_method, text_method, options = {}, html_options = {}, &block)
        @template.collection_checkboxes(@object_name, method, collection, value_method, text_method, objectify_options(options), @default_html_options.merge(html_options), &block)
      end

Defined in actionview/lib/action_view/helpers/form_options_helper.rb line 911 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionView::Helpers::FormBuilder

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close