Skip to content

Instantly share code, notes, and snippets.

@rumblestrut
Created July 10, 2011 02:51
Show Gist options
  • Select an option

  • Save rumblestrut/1074196 to your computer and use it in GitHub Desktop.

Select an option

Save rumblestrut/1074196 to your computer and use it in GitHub Desktop.
Option buttons for forms
<div class="field">
<%= f.label :state %><br />
<% states = { 'Kansas' => 'KS', 'Missouri' => 'MO', 'Nebraska' => 'NE' } %>
<% list = states.sort
list.each {|x| %>
<%= f.radio_button :state, x[1] %> <%= h(x[0]) %> <br />
<% } %>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment