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

block_params: 
comment: 
- !ruby/struct:SM::Flow::P 
  body: Returns a string of <tt>&lt;option&gt;</tt> tags, like <tt>options_from_collection_for_select</tt>, but groups them by <tt>&lt;optgroup&gt;</tt> tags based on the object relationships of the arguments.
- !ruby/struct:SM::Flow::P 
  body: "Parameters:"
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>collection</tt> - An array of objects representing the <tt>&lt;optgroup&gt;</tt> tags.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>group_method</tt> - The name of a method which, when called on a member of <tt>collection</tt>, returns an array of child objects representing the <tt>&lt;option&gt;</tt> tags.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: group_label_method+ - The name of a method which, when called on a member of <tt>collection</tt>, returns a string to be used as the <tt>label</tt> attribute for its <tt>&lt;optgroup&gt;</tt> tag.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>option_key_method</tt> - The name of a method which, when called on a child object of a member of <tt>collection</tt>, returns a value to be used as the <tt>value</tt> attribute for its <tt>&lt;option&gt;</tt> tag.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>option_value_method</tt> - The name of a method which, when called on a child object of a member of <tt>collection</tt>, returns a value to be used as the contents of its <tt>&lt;option&gt;</tt> tag.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>selected_key</tt> - A value equal to the <tt>value</tt> attribute for one of the <tt>&lt;option&gt;</tt> tags, which will have the <tt>selected</tt> attribute set. Corresponds to the return value of one of the calls to <tt>option_key_method</tt>. If <tt>nil</tt>, no selection is made.
  type: :BULLET
- !ruby/struct:SM::Flow::P 
  body: "Example object structure for use with this method:"
- !ruby/struct:SM::Flow::VERB 
  body: "  class Continent &lt; ActiveRecord::Base\n    has_many :countries\n    # attribs: id, name\n  end\n  class Country &lt; ActiveRecord::Base\n    belongs_to :continent\n    # attribs: id, name, continent_id\n  end\n"
- !ruby/struct:SM::Flow::P 
  body: "Sample usage:"
- !ruby/struct:SM::Flow::VERB 
  body: "  option_groups_from_collection_for_select(@continents, :countries, :name, :id, :name, 3)\n"
- !ruby/struct:SM::Flow::P 
  body: "Possible output:"
- !ruby/struct:SM::Flow::VERB 
  body: "  &lt;optgroup label=&quot;Africa&quot;&gt;\n    &lt;option value=&quot;1&quot;&gt;Egypt&lt;/option&gt;\n    &lt;option value=&quot;4&quot;&gt;Rwanda&lt;/option&gt;\n    ...\n  &lt;/optgroup&gt;\n  &lt;optgroup label=&quot;Asia&quot;&gt;\n    &lt;option value=&quot;3&quot; selected=&quot;selected&quot;&gt;China&lt;/option&gt;\n    &lt;option value=&quot;12&quot;&gt;India&lt;/option&gt;\n    &lt;option value=&quot;5&quot;&gt;Japan&lt;/option&gt;\n    ...\n  &lt;/optgroup&gt;\n"
- !ruby/struct:SM::Flow::P 
  body: <b>Note:</b> Only the <tt>&lt;optgroup&gt;</tt> and <tt>&lt;option&gt;</tt> tags are returned, so you still have to wrap the output in an appropriate <tt>&lt;select&gt;</tt> tag.
full_name: ActionView::Helpers::FormOptionsHelper#option_groups_from_collection_for_select
is_singleton: false
name: option_groups_from_collection_for_select
params: (collection, group_method, group_label_method, option_key_method, option_value_method, selected_key = nil)
visibility: public
