Skip to content

Instantly share code, notes, and snippets.

@shankardevy
Last active August 18, 2017 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shankardevy/9197ff3567dd4685e14cfe5d885bb131 to your computer and use it in GitHub Desktop.
Save shankardevy/9197ff3567dd4685e14cfe5d885bb131 to your computer and use it in GitHub Desktop.
defmodule Mango.CRM do
alias Mango.Repo
alias Mango.CRM.Customer
def build_customer(attrs \\ %{}) do
%Customer{}
|> Customer.changeset(attrs)
end
def create_customer(attrs) do
attrs
|> build_customer
|> Repo.insert
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment