Question : extract changeset error elixir
Answered by : tom-zk99pilqv6hu
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
Source : | Last Update : Wed, 01 Dec 21