Packages
ColonelKurtzEx facilitates working with the JavaScript block content editor [Colonel Kurtz](https://github.com/vigetlabs/colonel-kurtz) in Phoenix applications.
Current section
Files
Jump to
Current section
Files
lib/colonel_kurtz/ecto_helpers.ex
defmodule ColonelKurtz.EctoHelpers do
@moduledoc """
Ecto helpers such as `format_error` for formatting errors.
"""
@spec format_error(binary, keyword) :: binary
def format_error(message, opts) do
Enum.reduce(opts, message, fn {key, value}, acc ->
String.replace(acc, "%{#{key}}", to_string(value))
end)
end
end