Skip to content

Instantly share code, notes, and snippets.

@abitdodgy
Created November 21, 2016 19:29
Show Gist options
  • Save abitdodgy/ccb25e89c9ef8cf189c3fedb9bb86162 to your computer and use it in GitHub Desktop.
Save abitdodgy/ccb25e89c9ef8cf189c3fedb9bb86162 to your computer and use it in GitHub Desktop.

Revisions

  1. abitdodgy created this gist Nov 21, 2016.
    14 changes: 14 additions & 0 deletions registration_controller.ex
    Original 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