Skip to content

Instantly share code, notes, and snippets.

@BrandonMathis
Created May 23, 2019 15:12
Show Gist options
  • Save BrandonMathis/6ff24d7a1ea8c5724014805323276e5c to your computer and use it in GitHub Desktop.
Save BrandonMathis/6ff24d7a1ea8c5724014805323276e5c to your computer and use it in GitHub Desktop.
#...
def create(conn, %{"user" => user_params}) do
changeset = User.changeset(%User{}, user_params)
case Repo.insert(changeset) do
{:ok, _user} ->
conn
|> put_flash(:info, "User created successfully.")
|> redirect(to: user_path(conn, :index))
{:error, changeset} ->
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