collection_select

collection_select(method, collection, value_method, text_method, options = {}, html_options = {})
Instance Public methods

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

<%= form_for @post do |f| %>
  <%= f.collection_select :person_id, Author.all, :id, :name_with_initial, prompt: true %>
  <%= f.submit %>
<% end %>

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

doc_ruby_on_rails
2015-06-20 00:00:00
Comments
Leave a Comment

Please login to continue.