Skip to content

Instantly share code, notes, and snippets.

@abitdodgy
Created November 21, 2016 19:27
Show Gist options
  • Save abitdodgy/c201f4e26324684fdf0318fb1d5f4159 to your computer and use it in GitHub Desktop.
Save abitdodgy/c201f4e26324684fdf0318fb1d5f4159 to your computer and use it in GitHub Desktop.
Medium Article: Building Many-to-Many Associations with cast_assoc and Nested Forms in Phoenix and Ecto
defmodule App.RegistrationController do
# ...
def new(conn, _params) do
changeset =
Account.changeset(
%Account{memberships: [
%Membership{user: %User{}}]})
render conn, "new.html", changeset: changeset
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment