Skip to content

Instantly share code, notes, and snippets.

@lando2319
Last active December 24, 2015 15:29
Show Gist options
  • Select an option

  • Save lando2319/6820185 to your computer and use it in GitHub Desktop.

Select an option

Save lando2319/6820185 to your computer and use it in GitHub Desktop.
#view
Who's In?
<table>
<tr>
<td><h4>Name</h4></td><td><h4>Email</h4></td><td><h4>Number of Voting Shares</h4></td><td>
<%= form_tag(invites_path) do %>
<% 3.times do %>
<%= render 'invites/project_member_form' %>
<% end %>
<td><%= submit_tag 'Save' %></td><% end %>
</table>
#view partial
<tr><td><%= text_field_tag 'invite[][name]' %></td>
<td><%= email_field_tag 'invite[][email]' %></td>
<td><%= number_field_tag 'invite[][proposed_number_of_voting_shares]' %></td>
<td><%= number_field_tag 'invite[][proposed_number_of_non_voting_shares]' %></td></tr>
# controller
def create
@invite_1 = Invite.new(params[:invite][0])
@invite_2 = Invite.new(params[:invite][1])
@invite_3 = Invite.new(params[:invite][2])
respond_to do |format|
if @invite_1.save | @invite_2.save | @invite_3.save
format.html { redirect_to agreement_draft_path, notice: 'Invite was successfully created.' }
format.json { render json: @invite, status: :created, location: @invite }
else
format.html { render action: "new" }
format.json { render json: @invite.errors, status: :unprocessable_entity }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment