File size: 371 Bytes
d77a9fd
 
 
 
609a959
 
 
 
 
 
 
 
d77a9fd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
defmodule MedicalTranscription.Repo do
  use Ecto.Repo,
    otp_app: :medical_transcription,
    adapter: Ecto.Adapters.Postgres

  def collect_errors(changeset) do
    Ecto.Changeset.traverse_errors(changeset, fn {msg, opts} ->
      Enum.reduce(opts, msg, fn {key, value}, acc ->
        String.replace(acc, "%{#{key}}", to_string(value))
      end)
    end)
  end
end