Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save mpugach/3174884 to your computer and use it in GitHub Desktop.

Select an option

Save mpugach/3174884 to your computer and use it in GitHub Desktop.
Form_for drop down list and date select fields.
<%= form_for(@person) do |f| %>
<%= f.label :gender %>
<%= f.select :gender, options_for_select([["Male", true], ["Female", false]]) %>
<%-# in this case :gender is boolean -%>
<%= f.label :birthdate, "Birthday" %>
<%= f.date_select :birthdate, :start_year => 1940 %>
<%= f.submit "Submit" %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment