instance method collection_radio_buttons

Ruby on Rails 7.1.6

Since v4.0.13

Available in: v4.0.13 v4.1.16 v4.2.9 v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

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

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

<%= form_for @post do |f| %>
  <%= f.collection_radio_buttons :author_id, 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 920
      def collection_radio_buttons(method, collection, value_method, text_method, options = {}, html_options = {}, &block)
        @template.collection_radio_buttons(@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 920 · 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