Skip to content

Instantly share code, notes, and snippets.

@amcaplan
Created April 2, 2014 04:39
Show Gist options
  • Save amcaplan/698d2c5258d0b3980be9 to your computer and use it in GitHub Desktop.
Save amcaplan/698d2c5258d0b3980be9 to your computer and use it in GitHub Desktop.
Guest form without person_field
<% @people.each_with_index do |person, index| %>
<div class="row">
<%= f.fields_for(person) do |ff| %>
<div class="medium-4 small-12 columns">
Name: <%= ff.text_field :name, name: "person[][name]" %>
</div>
<div class="medium-4 small-12 columns">
Email: <%= ff.text_field :email, name: "person[][email]" %>
</div>
<div class="medium-4 small-12 columns">
<% mp = person.meal_people.where(meal: @meal).first %>
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?") %><br>
</div>
<%= raw("<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