Created
May 23, 2019 15:12
-
-
Save BrandonMathis/6ff24d7a1ea8c5724014805323276e5c to your computer and use it in GitHub Desktop.
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
#... | |
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