From 76392ebcfe772945be317d21e7b86364e3c4855c Mon Sep 17 00:00:00 2001 From: neodarz Date: Fri, 17 Feb 2017 10:21:15 +0100 Subject: Fix error with the audio_file when upload file via web gui --- web/controllers/audio_file_controller.ex | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/web/controllers/audio_file_controller.ex b/web/controllers/audio_file_controller.ex index 95bc763..2c34e86 100644 --- a/web/controllers/audio_file_controller.ex +++ b/web/controllers/audio_file_controller.ex @@ -22,16 +22,16 @@ defmodule TheTranscriberBackend.AudioFileController do audio_duration: audio_duration}) case Repo.insert(changeset) do - {:ok, audio_file_api} -> - File.cp(upload.path, "#{path}#{audio_file_api.id}_#{upload.filename}") + {:ok, audio_file} -> + File.cp(upload.path, "#{path}#{audio_file.id}_#{upload.filename}") conn |> put_status(:created) - |> put_resp_header("location", audio_file_api_path(conn, :show, audio_file_api)) - |> render("show.json", audio_file_api: audio_file_api) + |> put_resp_header("location", audio_file_path(conn, :show, audio_file)) + |> render("show.html", audio_file: audio_file) {:error, changeset} -> conn |> put_status(:unprocessable_entity) - |> render(TheTranscriberBackend.ChangesetView, "error.json", changeset: changeset) + |> render(TheTranscriberBackend.ChangesetView, "error.html", changeset: changeset) end end -- cgit v1.2.1