Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def create(conn, %{"league" => league_params}) do
- league = %League{}
- |> League.changeset(league_params)
- |> Repo.insert()
- case league do
- {:ok, league} ->
- conn
- |> put_flash(:info, "League Created Successfully.")
- |> redirect(to: page_path(conn, :index))
- {:error, %Ecto.Changeset{} = changeset} ->
- render(conn, "new.html", changeset: changeset)
- end
- end
Add Comment
Please, Sign In to add comment