We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 867060f commit db24c6aCopy full SHA for db24c6a
1 file changed
lib/blog/accounts/accounts.ex
@@ -13,6 +13,9 @@ defmodule Blog.Accounts do
13
with {:ok, contact} <- create_contact(contact_attrs),
14
{:ok, user} <- do_create_user(user_attrs, contact) do
15
%{user | contacts: [contact]}
16
+ else
17
+ {:error, changeset} ->
18
+ Repo.rollback(changeset)
19
end
20
21
@@ -21,14 +24,14 @@ defmodule Blog.Accounts do
24
def create_contact(attrs) do
22
25
attrs
23
26
|> Accounts.Contact.changeset
- |> Blog.Repo.insert
27
+ |> Repo.insert
28
29
30
defp do_create_user(attrs, contact) do
31
32
|> Map.put(:contact_id, contact.id)
33
|> Accounts.User.changeset
34
35
36
37
0 commit comments