aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2017-02-17 10:21:15 +0100
committerneodarz <neodarz@neodarz.net>2017-02-17 10:21:15 +0100
commit76392ebcfe772945be317d21e7b86364e3c4855c (patch)
treedd3d2e878802aa71556384fa1cfdf02b20df925c
parent146ff0f004d2baa9dbdeafacda4bde7dbb7b0e33 (diff)
downloadthe_transcriber_backend-76392ebcfe772945be317d21e7b86364e3c4855c.tar.xz
the_transcriber_backend-76392ebcfe772945be317d21e7b86364e3c4855c.zip
Fix error with the audio_file when upload file via web gui
-rw-r--r--web/controllers/audio_file_controller.ex10
1 files 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