You can pass an array like
[['caption1', 'value1'], ['caption2', 'value2']]
to select , and it will generate smth, like
<select> <option value="value1">caption1</option> <option value="value2">caption2</option> </select>
In your case, you can do this:
<%= f.select :status, Product::PRODUCTSTATES.map { |s| [s.humanize, s] } %>
You will receive humanized versions of the statuses displayed on the page, and the original (non-humanized) versions will be sent to the server when the form is submitted.
See select and options_for_select more details.
source share