Ecto.Changeset.validate_acceptance

You're seeing just the function validate_acceptance, go back to Ecto.Changeset module for more information.
Link to this function

validate_acceptance(changeset, field, opts \\ [])

View Source

Specs

validate_acceptance(t(), atom(), Keyword.t()) :: t()

Validates the given parameter is true.

Note this validation only checks the parameter itself is true, never the field in the schema. That's because acceptance parameters do not need to be persisted, as by definition they would always be stored as true.

Options

  • :message - the message on failure, defaults to "must be accepted"

Examples

validate_acceptance(changeset, :terms_of_service)
validate_acceptance(changeset, :rules, message: "please accept rules")