title: How do I add HTML attributes to select options with Simple Form Rails?
body: <p>I need to add a custom HTML attribute to each <code>option</code> for a <code>select</code> control. I'm using simple_form in Rails. Does anyone know how to do this? The attribute will be consumed by client-side JS.</p>
  
  <p>For instance, I want to do something like this:</p>
  
  <pre><code>&lt;%= f.input :group, collection: @groups, option_html: { data-type: lambda { |g| g[2] } } %&gt;
  </code></pre>
  
  <p>Which would produce (simplified):</p>
  
  <pre><code>&lt;select&gt;
      &lt;option value="1" data-type="primary"&gt;First Group&lt;/option&gt;
      &lt;option value="2" data-type="secondary"&gt;Second Group&lt;/option&gt;
      &lt;option value="3" data-type="secondary"&gt;Third Group&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>Where <code>@groups</code> might look like this:</p>
  
  <pre><code>[
      ['First Group', 1, 'primary'],
      ['Second Group', 2, 'secondary'],
      ['Third Group', 3, 'secondary']
  ]
  </code></pre>
  
  <p>Hoping to avoid having to make a custom control/wrapper. Thanks!</p>