Created
November 21, 2016 19:28
-
-
Save abitdodgy/35082ca7bb49fcc33cfd0a7a67afac7a to your computer and use it in GitHub Desktop.
Medium Article: Medium Article: Building Many-to-Many Associations with cast_assoc and Nested Forms in Phoenix and Ecto
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
<%= form_for @changeset, registration_path(@conn, :create), fn f -> %> | |
<div class="form-group"> | |
<%= label f, :name %> | |
<%= text_input f, :name, class: "form-control" %> | |
<%= error_tag f, :name %> | |
</div> | |
<div class="form-group"> | |
<%= inputs_for f, :memberships, fn mf -> %> | |
<%= inputs_for mf, :user, fn uf -> %> | |
<div class="form-group"> | |
<%= label uf, :email %> | |
<%= text_input uf, :email, class: "form-control" %> | |
<%= error_tag uf, :email %> | |
</div> | |
<% end %> | |
<% end %> | |
</div> | |
<%= submit "Create", class: "btn btn-primary" %> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment