Am trying to create a profile page where the user can check "male" or "female". After saving the form, whenever the user visits the page again, the gender must be set by default based on the data stored in the database.
Am using the form_for helper here.
<%= form_for @profile do |f| %>
<%= f.label :gender, "Male", :value => "m" do %>
<%= f.radio_button :gender, "m" %>
<% end %>
<%= f.label :gender, "Female", :value => "f" do %>
<%= f.radio_button :gender, "f" %>
<% end %>
<% end %>
Aucun commentaire:
Enregistrer un commentaire