View Source Flamel.Ecto.Validators (flamel v1.3.0)

Some validation functions for Ecto

Summary

Functions

A validate function that checks to see at least one of the fields is not blank

Functions

Link to this function

validate_at_least_one_required(changeset, fields, msg)

View Source
@spec validate_at_least_one_required(Ecto.Changeset.t(), [atom()], binary()) ::
  Ecto.Changeset.t()

A validate function that checks to see at least one of the fields is not blank

Example

iex> Flamel.Ecto.Validators.validate_at_least_one_required(changeset, [:phone, :email], "either phone or email is required")