data Rotor::FieldError(field: Symbol, message: String, validation: Symbol, meta: Hash[Symbol, Int | Float | String | Symbol | Array[Int | Float | String | Bool | Time | Bytes]])

An error of a changeset: the field it is on (:base for the whole), its message as a template (should be at most %{count} characters), the validation that made it (:required, :length, :cast, a constraint's kind...), and the values the template names (count, kind...), so that an application can translate by validation and meta rather than by text.

/home/runner/work/rotor/rotor/src/changeset.qz:14

Methods

def field -> Symbol

/home/runner/work/rotor/rotor/src/changeset.qz:14

def message -> String

/home/runner/work/rotor/rotor/src/changeset.qz:14

def validation -> Symbol

/home/runner/work/rotor/rotor/src/changeset.qz:14

def meta -> Hash[Symbol, Int | Float | String | Symbol | Array[Int | Float | String | Bool | Time | Bytes]]

/home/runner/work/rotor/rotor/src/changeset.qz:14

def text -> String

The message with its placeholders filled from meta.

Rotor::FieldError.new(:name, "should be at most %{count} character(s)", :length, {count: 3}).text  # => "should be at most 3 character(s)"

/home/runner/work/rotor/rotor/src/changeset.qz:20

def to_h -> Hash[Symbol, Object]

The fields as a Hash, by name.

/home/runner/work/rotor/rotor/src/changeset.qz:20

def with(*, field: Symbol = …, message: String = …, validation: Symbol = …, meta: Hash[Symbol, Int | Float | String | Symbol | Array[Int | Float | String | Bool | Time | Bytes]] = …) -> Rotor::FieldError

A copy with the fields given replaced.

/home/runner/work/rotor/rotor/src/changeset.qz:20