--- !ruby/object:RI::MethodDescription 
aliases: []

block_params: 
comment: 
- !ruby/struct:SM::Flow::P 
  body: "Returns a string of option tags that have been compiled by iterating over the <tt>collection</tt> and assigning the the result of a call to the <tt>value_method</tt> as the option value and the <tt>text_method</tt> as the option text. Example:"
- !ruby/struct:SM::Flow::VERB 
  body: "  options_from_collection_for_select(@people, 'id', 'name')\n"
- !ruby/struct:SM::Flow::P 
  body: "This will output the same HTML as if you did this:"
- !ruby/struct:SM::Flow::VERB 
  body: "  &lt;option value=&quot;#{person.id}&quot;&gt;#{person.name}&lt;/option&gt;\n"
- !ruby/struct:SM::Flow::P 
  body: "This is more often than not used inside a #select_tag like this example:"
- !ruby/struct:SM::Flow::VERB 
  body: "  select_tag 'person', options_from_collection_for_select(@people, 'id', 'name')\n"
- !ruby/struct:SM::Flow::P 
  body: If <tt>selected</tt> is specified as a value or array of values, the element(s) returning a match on <tt>value_method</tt> will be selected option tag(s).
- !ruby/struct:SM::Flow::P 
  body: If <tt>selected</tt> is specified as a Proc, those members of the collection that return true for the anonymous function are the selected values.
- !ruby/struct:SM::Flow::P 
  body: <tt>selected</tt> can also be a hash, specifying both <tt>:selected</tt> and/or <tt>:disabled</tt> values as required.
- !ruby/struct:SM::Flow::P 
  body: "Be sure to specify the same class as the <tt>value_method</tt> when specifying selected or disabled options. Failure to do this will produce undesired results. Example:"
- !ruby/struct:SM::Flow::VERB 
  body: "  options_from_collection_for_select(@people, 'id', 'name', '1')\n"
- !ruby/struct:SM::Flow::P 
  body: Will not select a person with the id of 1 because 1 (an Integer) is not the same as '1' (a string)
- !ruby/struct:SM::Flow::VERB 
  body: "  options_from_collection_for_select(@people, 'id', 'name', 1)\n"
- !ruby/struct:SM::Flow::P 
  body: should produce the desired results.
full_name: ActionView::Helpers::FormOptionsHelper#options_from_collection_for_select
is_singleton: false
name: options_from_collection_for_select
params: (collection, value_method, text_method, selected = nil)
visibility: public
