Created
April 2, 2014 04:38
-
-
Save amcaplan/d34f0b701ffa566c15dc to your computer and use it in GitHub Desktop.
Guest form using person_field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% @people.each_with_index do |person, index| %> | |
<div class="row"> | |
<%= f.fields_for(person) do |ff| %> | |
<%= person_field("Name:#{ff.text_field :name, name: "person[][name]"}") %> | |
<%= person_field("Email:#{ff.text_field :email, name: "person[][email]"}") %> | |
<% mp = person.meal_people.where(meal: @meal).first %> | |
<%= person_field do %> | |
Relationship: | |
<%= select_tag(:host_relationship, | |
options_for_select(['friend','relative','neighbor', | |
'coworker', 'student','teacher','clergy', 'other'], | |
[(mp.host_relationship if mp)]), | |
name: "person[][host_relationship]", | |
prompt: "Who is s/he to you?") %> | |
<% end %> | |
<br> | |
<%= tag(:hr) unless index == @people.length - 1 %> | |
<% end %> | |
</div> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment