From 532c3a6538d3cc5916cb5bafeaab931164089e20 Mon Sep 17 00:00:00 2001 From: Vincent Jousse Date: Wed, 25 Jan 2017 12:53:42 +0100 Subject: Quick fix for the upload to work --- web/controllers/audio_file_controller.ex | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/web/controllers/audio_file_controller.ex b/web/controllers/audio_file_controller.ex index 630e0fe..c32a7f8 100644 --- a/web/controllers/audio_file_controller.ex +++ b/web/controllers/audio_file_controller.ex @@ -19,8 +19,13 @@ defmodule TheTranscriberBackend.AudioFileController do path = "/media/phoenix_test/#{upload.filename}" File.cp(upload.path, path) end - changeset = AudioFile.changeset(%AudioFile{}, audio_file_params) - |> Ecto.Changeset.put_change(:audio_path, path) + + # "Non-elixir" way of doing things + changeset = AudioFile.changeset(%AudioFile{}, + %{audio_path: path, + transcription_file_path: audio_file_params["transcription_file_path"], + audio_duration: audio_file_params["audio_duration"]}) + IO.inspect changeset case Repo.insert(changeset) do -- cgit v1.2.1