Upgrade to phoenix 1.5

This commit is contained in:
Adrian Kumpf
2020-04-20 12:54:56 +02:00
parent 0f228677ba
commit 155a135d51
55 changed files with 1580 additions and 1444 deletions

View File

@@ -45,8 +45,8 @@ defmodule TeslaMate.DataCase do
"""
def errors_on(changeset) do
Ecto.Changeset.traverse_errors(changeset, fn {message, opts} ->
Enum.reduce(opts, message, fn {key, value}, acc ->
String.replace(acc, "%{#{key}}", to_string(value))
Regex.replace(~r"%{(\w+)}", message, fn _, key ->
opts |> Keyword.get(String.to_existing_atom(key), key) |> to_string()
end)
end)
end