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
def message -> String
def validation -> Symbol
def meta -> Hash[Symbol, Int | Float | String | Symbol | Array[Int | Float | String | Bool | Time | Bytes]]
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)"
def to_h -> Hash[Symbol, Object]
The fields as a Hash, by name.
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.