title: Rails collection select with Enum values
body: <p>I have the below code which displays a dropdown to the user containing a list of possible streams.</p>
  
  <pre><code>Select Stream ID: 
  &lt;%=  f.select :stream_id, Log.stream_types.keys.to_a.map { |w| [w.humanize, w] } %&gt;
  </code></pre>
  
  <p>The enum is defined in the Log model as shown below and the Log model has a field named stream_type_id as shown below. </p>
  
  <pre><code>enum stream_type: {P1: 1, P2: 2, P3: 3, P4: 4, SR: 5, PASM1: 6, PASM2: 7, AME: 8, AD: 9, Training: 10, Vacation: 11, Sick_Leave: 12, Comp_off: 13, PH_OH: 14 }
  </code></pre>
  
  <p>When i display the page html code, the below is shown:</p>
  
  <pre><code>&lt;select id="log_stream_id" name="log[stream_id]"&gt;&lt;option  value="P1"&gt;P1&lt;/option&gt;
  &lt;option value="P2"&gt;P2&lt;/option&gt;
  &lt;option value="P3"&gt;P3&lt;/option&gt;
  &lt;option value="P4"&gt;P4&lt;/option&gt;
  &lt;option value="SR"&gt;Sr&lt;/option&gt;
  &lt;option value="PASM1"&gt;Pasm1&lt;/option&gt;
  &lt;option value="PASM2"&gt;Pasm2&lt;/option&gt;
  &lt;option value="AME"&gt;Ame&lt;/option&gt;
  &lt;option value="AD"&gt;Ad&lt;/option&gt;
  &lt;option value="Training"&gt;Training&lt;/option&gt;
  &lt;option value="Vacation"&gt;Vacation&lt;/option&gt;
  &lt;option value="Sick_Leave"&gt;Sick leave&lt;/option&gt;
  &lt;option value="Comp_off"&gt;Comp off&lt;/option&gt;
  &lt;option value="PH_OH"&gt;Ph oh&lt;/option&gt;&lt;/select&gt;
  </code></pre>
  
  <p>How can i write the code that the integer value corresponding to the selected stream is passed when the user submits the form and not the String value?   </p>