Created
November 21, 2016 19:29
-
-
Save abitdodgy/ccb25e89c9ef8cf189c3fedb9bb86162 to your computer and use it in GitHub Desktop.
Revisions
-
abitdodgy created this gist
Nov 21, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ defmodule Class.RegistrationController do # ... def create(conn, %{"account" => params}) do changeset = Account.changeset(%Account{}, params) case Repo.insert(changeset) do {:ok, account} -> redirect conn, to: registration_path(conn, :new) {:error, changeset} -> changeset = %{changeset | action: :insert} render conn, "new.html", changeset: changeset end end end