Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example pipe operator
def registration_changeset(model, params) do
model
|> cast(params, [:email, :password])
|> validate_required([:email, :password])
|> validate_format(:email, ~r/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/)
|> unique_constraint(:email)
|> validate_length(:password, min: 8)
|> update_password?()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment