Method: ActionView::Helpers::FormBuilder#select

Defined in:
actionview/lib/action_view/helpers/form_options_helper.rb

#select(method, choices = nil, options = {}, html_options = {}, &block) ⇒ Object

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

<%= form_with model: @post do |f| %>
  <%= f.select :person_id, Person.all.collect { |p| [ p.name, p.id ] }, include_blank: true %>
  <%= f.submit %>
<% end %>

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



849
850
851
# File 'actionview/lib/action_view/helpers/form_options_helper.rb', line 849

def select(method, choices = nil, options = {}, html_options = {}, &block)
  @template.select(@object_name, method, choices, objectify_options(options), @default_html_options.merge(html_options), &block)
end