instance method
select
Ruby on Rails 6.0.6
Since v2.2.3Signature
select(method, choices = nil, options = {}, html_options = {}, &block)
Wraps ActionView::Helpers::FormOptionsHelper#select for form builders:
<%= form_for @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.
Parameters
-
methodreq -
choicesopt = nil -
optionsopt = {} -
html_optionsopt = {} -
blockblock
Source
# File actionview/lib/action_view/helpers/form_options_helper.rb, line 831
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
Defined in actionview/lib/action_view/helpers/form_options_helper.rb line 831
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionView::Helpers::FormBuilder