mirror of
https://github.com/mgerb/classic-wow-forums
synced 2026-01-12 01:52:49 +00:00
lots of things done: thread - reply - category - seeds
This commit is contained in:
12
lib/myapp/data/util.ex
Normal file
12
lib/myapp/data/util.ex
Normal file
@@ -0,0 +1,12 @@
|
||||
defmodule MyApp.Data.Util do
|
||||
|
||||
def map_changeset(changeset) do
|
||||
Enum.map(changeset.errors, fn {key, val} ->
|
||||
%{key => elem(val, 0)}
|
||||
end)
|
||||
end
|
||||
|
||||
def process_insert_or_update({:error, changeset}), do: {:error, map_changeset(changeset)}
|
||||
def process_insert_or_update({:ok, data}), do: {:ok, data}
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user