1
0
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:
2018-01-02 23:38:17 -06:00
parent 3a61151191
commit 115dacdd12
15 changed files with 291 additions and 27 deletions

12
lib/myapp/data/util.ex Normal file
View 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