📜  提取变更集错误长生不老药代码示例

📅  最后修改于: 2022-03-11 14:48:01.705000             🧑  作者: Mango

代码示例1
defmodule Project.Helpers.Error do

  @doc """
    This method is used to extract changeset information for putting into flash notices
  """
  def extract_changeset_error(changeset) do
    [ {field, {description, [{_, validation} | _]}} | _] = changeset.errors
    Macro.camelize("#{field} #{description}. It is #{validation}. ")
  end

end